Commit 5f68d078 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki
Browse files

thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers



The thermal zone device structure is exposed to the different drivers
and obviously they access the internals while that should be
restricted to the core thermal code.

In order to self-encapsulate the thermal core code, we need to prevent
the drivers accessing directly the thermal zone structure and provide
accessor functions to deal with.

Use the devdata accessor introduced in the previous patch.

No functional changes intended.

Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> #R-Car
Acked-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> #MediaTek auxadc and lvts
Reviewed-by: Balsam CHIHI <bchihi@baylibre.com> #Mediatek lvts
Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> #da9062
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>  #spread
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> #sun8i_thermal
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com> #Broadcom
Reviewed-by: Dhruva Gole <d-gole@ti.com> # K3 bandgap
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: Heiko Stuebner <heiko@sntech.de> #rockchip
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> #uniphier
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent a6ff3c00
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ static int amlogic_thermal_disable(struct amlogic_thermal *data)
static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
	unsigned int tval;
	struct amlogic_thermal *pdata = tz->devdata;
	struct amlogic_thermal *pdata = thermal_zone_device_priv(tz);

	if (!pdata)
		return -EINVAL;
+2 −2
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
				  int *temp)
{
	struct armada_thermal_priv *priv = thermal->devdata;
	struct armada_thermal_priv *priv = thermal_zone_device_priv(thermal);
	int ret;

	/* Valid check */
@@ -420,7 +420,7 @@ static struct thermal_zone_device_ops legacy_ops = {

static int armada_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct armada_thermal_sensor *sensor = tz->devdata;
	struct armada_thermal_sensor *sensor = thermal_zone_device_priv(tz);
	struct armada_thermal_priv *priv = sensor->priv;
	int ret;

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ struct bcm2711_thermal_priv {

static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct bcm2711_thermal_priv *priv = tz->devdata;
	struct bcm2711_thermal_priv *priv = thermal_zone_device_priv(tz);
	int slope = thermal_zone_get_slope(tz);
	int offset = thermal_zone_get_offset(tz);
	u32 val;
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)

static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct bcm2835_thermal_data *data = tz->devdata;
	struct bcm2835_thermal_data *data = thermal_zone_device_priv(tz);
	u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT);

	if (!(val & BCM2835_TS_TSENSSTAT_VALID))
+2 −2
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv,

static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct brcmstb_thermal_priv *priv = tz->devdata;
	struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz);
	u32 val;
	long t;

@@ -262,7 +262,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data)

static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high)
{
	struct brcmstb_thermal_priv *priv = tz->devdata;
	struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz);

	dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high);

Loading