Commit 3d4e1bad authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki
Browse files

thermal/core: Use the thermal zone 'devdata' accessor in remaining 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>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com> #mlxsw
Acked-by: Gregory Greenman <gregory.greenman@intel.com> #iwlwifi
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> #power_supply
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> #ahci
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0ce637a5
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)

static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
	int result;

	if (!tz)
@@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
static int thermal_get_trip_type(struct thermal_zone_device *thermal,
				 int trip, enum thermal_trip_type *type)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
	int i;

	if (!tz || trip < 0)
@@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
				 int trip, int *temp)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
	int i;

	if (!tz || trip < 0)
@@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
				int *temperature)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

	if (tz->trips.critical.flags.valid) {
		*temperature = deci_kelvin_to_millicelsius_with_offset(
@@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
static int thermal_get_trend(struct thermal_zone_device *thermal,
			     int trip, enum thermal_trend *trend)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
	enum thermal_trip_type type;
	int i;

@@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,

static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

	acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
					dev_name(&tz->device->dev),
@@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)

static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
{
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

	acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
					dev_name(&tz->device->dev),
@@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
					  bool bind)
{
	struct acpi_device *device = cdev->devdata;
	struct acpi_thermal *tz = thermal->devdata;
	struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
	struct acpi_device *dev;
	acpi_handle handle;
	int i;
+1 −1
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp)

static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
{
	return __sata_ahci_read_temperature(tz->devdata, temp);
	return __sata_ahci_read_temperature(thermal_zone_device_priv(tz), temp);
}

static ssize_t sata_ahci_show_temp(struct device *dev,
+1 −1
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)

static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct sun4i_gpadc_iio *info = tz->devdata;
	struct sun4i_gpadc_iio *info = thermal_zone_device_priv(tz);
	int val, scale, offset;

	if (sun4i_gpadc_temp_read(info->indio_dev, &val))
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)

static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
{
	return sun4i_get_temp(tz->devdata, temp);
	return sun4i_get_temp(thermal_zone_device_priv(tz), temp);
}

static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
				  int *temp)
{
	struct adapter *adap = tzdev->devdata;
	struct adapter *adap = thermal_zone_device_priv(tzdev);
	u32 param, val;
	int ret;

Loading