Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'thermal-core' into thermal

Merge thermal control updates for 6.4-rc1:

- Add a thermal zone 'devdata' accessor and modify several drivers to
use it (Daniel Lezcano).

- Prevent drivers from using the 'device' internal thermal zone
structure field directly (Daniel Lezcano).

- Clean up the hwmon thermal driver (Daniel Lezcano).

- Add thermal zone id accessor and thermal zone type accessor
and prevent drivers from using thermal zone fields directly (Daniel
Lezcano).

- Clean up the acerhdf and tegra thermal drivers (Daniel Lezcano).

* thermal-core:
thermal/drivers/acerhdf: Remove pointless governor test
thermal/drivers/acerhdf: Make interval setting only at module load time
thermal/drivers/tegra: Remove unneeded lock when setting a trip point
thermal/hwmon: Use the thermal_core.h header
thermal/drivers/da9062: Don't access the thermal zone device fields
thermal: Use thermal_zone_device_type() accessor
thermal: Add a thermal zone id accessor
thermal/drivers/spear: Don't use tz->device but pdev->dev
thermal/core: Add thermal_zone_device structure 'type' accessor
thermal: Don't use 'device' internal thermal zone structure field
thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs()
thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs()
thermal: Remove debug or error messages in get_temp() ops
thermal/core: Show a debug message when get_temp() fails
thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers
thermal/core: Use the thermal zone 'devdata' accessor in hwmon located drivers
thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers
thermal/core: Add a thermal zone 'devdata' accessor

+218 -246
+9 -9
drivers/acpi/thermal.c
··· 498 498 499 499 static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) 500 500 { 501 - struct acpi_thermal *tz = thermal->devdata; 501 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 502 502 int result; 503 503 504 504 if (!tz) ··· 516 516 static int thermal_get_trip_type(struct thermal_zone_device *thermal, 517 517 int trip, enum thermal_trip_type *type) 518 518 { 519 - struct acpi_thermal *tz = thermal->devdata; 519 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 520 520 int i; 521 521 522 522 if (!tz || trip < 0) ··· 560 560 static int thermal_get_trip_temp(struct thermal_zone_device *thermal, 561 561 int trip, int *temp) 562 562 { 563 - struct acpi_thermal *tz = thermal->devdata; 563 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 564 564 int i; 565 565 566 566 if (!tz || trip < 0) ··· 613 613 static int thermal_get_crit_temp(struct thermal_zone_device *thermal, 614 614 int *temperature) 615 615 { 616 - struct acpi_thermal *tz = thermal->devdata; 616 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 617 617 618 618 if (tz->trips.critical.flags.valid) { 619 619 *temperature = deci_kelvin_to_millicelsius_with_offset( ··· 628 628 static int thermal_get_trend(struct thermal_zone_device *thermal, 629 629 int trip, enum thermal_trend *trend) 630 630 { 631 - struct acpi_thermal *tz = thermal->devdata; 631 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 632 632 enum thermal_trip_type type; 633 633 int i; 634 634 ··· 670 670 671 671 static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal) 672 672 { 673 - struct acpi_thermal *tz = thermal->devdata; 673 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 674 674 675 675 acpi_bus_generate_netlink_event(tz->device->pnp.device_class, 676 676 dev_name(&tz->device->dev), ··· 679 679 680 680 static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal) 681 681 { 682 - struct acpi_thermal *tz = thermal->devdata; 682 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 683 683 684 684 acpi_bus_generate_netlink_event(tz->device->pnp.device_class, 685 685 dev_name(&tz->device->dev), ··· 693 693 bool bind) 694 694 { 695 695 struct acpi_device *device = cdev->devdata; 696 - struct acpi_thermal *tz = thermal->devdata; 696 + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); 697 697 struct acpi_device *dev; 698 698 acpi_handle handle; 699 699 int i; ··· 842 842 goto acpi_bus_detach; 843 843 844 844 dev_info(&tz->device->dev, "registered as thermal_zone%d\n", 845 - tz->thermal_zone->id); 845 + thermal_zone_device_id(tz->thermal_zone)); 846 846 847 847 return 0; 848 848
+1 -1
drivers/ata/ahci_imx.c
··· 418 418 419 419 static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp) 420 420 { 421 - return __sata_ahci_read_temperature(tz->devdata, temp); 421 + return __sata_ahci_read_temperature(thermal_zone_device_priv(tz), temp); 422 422 } 423 423 424 424 static ssize_t sata_ahci_show_temp(struct device *dev,
+2 -2
drivers/hwmon/hwmon.c
··· 154 154 #ifdef CONFIG_THERMAL_OF 155 155 static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 156 156 { 157 - struct hwmon_thermal_data *tdata = tz->devdata; 157 + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); 158 158 struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); 159 159 int ret; 160 160 long t; ··· 171 171 172 172 static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) 173 173 { 174 - struct hwmon_thermal_data *tdata = tz->devdata; 174 + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); 175 175 struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); 176 176 const struct hwmon_chip_info *chip = hwdev->chip; 177 177 const struct hwmon_channel_info **info = chip->info;
+1 -1
drivers/hwmon/pmbus/pmbus_core.c
··· 1272 1272 1273 1273 static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 1274 1274 { 1275 - struct pmbus_thermal_data *tdata = tz->devdata; 1275 + struct pmbus_thermal_data *tdata = thermal_zone_device_priv(tz); 1276 1276 struct pmbus_sensor *sensor = tdata->sensor; 1277 1277 struct pmbus_data *pmbus_data = tdata->pmbus_data; 1278 1278 struct i2c_client *client = to_i2c_client(pmbus_data->dev);
+2 -2
drivers/hwmon/scmi-hwmon.c
··· 141 141 { 142 142 int ret; 143 143 long value; 144 - struct scmi_thermal_sensor *th_sensor = tz->devdata; 144 + struct scmi_thermal_sensor *th_sensor = thermal_zone_device_priv(tz); 145 145 146 146 ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info, 147 147 &value); ··· 220 220 sensor->name); 221 221 } else { 222 222 dev_dbg(dev, "Sensor '%s' attached to thermal zone ID:%d\n", 223 - sensor->name, tzd->id); 223 + sensor->name, thermal_zone_device_id(tzd)); 224 224 } 225 225 226 226 return 0;
+1 -1
drivers/hwmon/scpi-hwmon.c
··· 64 64 65 65 static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) 66 66 { 67 - struct scpi_thermal_zone *zone = tz->devdata; 67 + struct scpi_thermal_zone *zone = thermal_zone_device_priv(tz); 68 68 struct scpi_sensors *scpi_sensors = zone->scpi_sensors; 69 69 struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops; 70 70 struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];
+1 -1
drivers/iio/adc/sun4i-gpadc-iio.c
··· 414 414 415 415 static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp) 416 416 { 417 - struct sun4i_gpadc_iio *info = tz->devdata; 417 + struct sun4i_gpadc_iio *info = thermal_zone_device_priv(tz); 418 418 int val, scale, offset; 419 419 420 420 if (sun4i_gpadc_temp_read(info->indio_dev, &val))
+1 -1
drivers/input/touchscreen/sun4i-ts.c
··· 194 194 195 195 static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp) 196 196 { 197 - return sun4i_get_temp(tz->devdata, temp); 197 + return sun4i_get_temp(thermal_zone_device_priv(tz), temp); 198 198 } 199 199 200 200 static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
+1 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
··· 12 12 static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev, 13 13 int *temp) 14 14 { 15 - struct adapter *adap = tzdev->devdata; 15 + struct adapter *adap = thermal_zone_device_priv(tzdev); 16 16 u32 param, val; 17 17 int ret; 18 18
+8 -8
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
··· 177 177 178 178 if (crit_temp > emerg_temp) { 179 179 dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n", 180 - tz->tzdev->type, crit_temp, emerg_temp); 180 + thermal_zone_device_type(tz->tzdev), crit_temp, emerg_temp); 181 181 return 0; 182 182 } 183 183 ··· 201 201 static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev, 202 202 struct thermal_cooling_device *cdev) 203 203 { 204 - struct mlxsw_thermal *thermal = tzdev->devdata; 204 + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); 205 205 struct device *dev = thermal->bus_info->dev; 206 206 int i, err; 207 207 ··· 227 227 static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, 228 228 struct thermal_cooling_device *cdev) 229 229 { 230 - struct mlxsw_thermal *thermal = tzdev->devdata; 230 + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); 231 231 struct device *dev = thermal->bus_info->dev; 232 232 int i; 233 233 int err; ··· 249 249 static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, 250 250 int *p_temp) 251 251 { 252 - struct mlxsw_thermal *thermal = tzdev->devdata; 252 + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); 253 253 struct device *dev = thermal->bus_info->dev; 254 254 char mtmp_pl[MLXSW_REG_MTMP_LEN]; 255 255 int temp; ··· 281 281 static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev, 282 282 struct thermal_cooling_device *cdev) 283 283 { 284 - struct mlxsw_thermal_module *tz = tzdev->devdata; 284 + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); 285 285 struct mlxsw_thermal *thermal = tz->parent; 286 286 int i, j, err; 287 287 ··· 310 310 static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev, 311 311 struct thermal_cooling_device *cdev) 312 312 { 313 - struct mlxsw_thermal_module *tz = tzdev->devdata; 313 + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); 314 314 struct mlxsw_thermal *thermal = tz->parent; 315 315 int i; 316 316 int err; ··· 356 356 static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, 357 357 int *p_temp) 358 358 { 359 - struct mlxsw_thermal_module *tz = tzdev->devdata; 359 + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); 360 360 struct mlxsw_thermal *thermal = tz->parent; 361 361 int temp, crit_temp, emerg_temp; 362 362 struct device *dev; ··· 391 391 static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev, 392 392 int *p_temp) 393 393 { 394 - struct mlxsw_thermal_module *tz = tzdev->devdata; 394 + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); 395 395 struct mlxsw_thermal *thermal = tz->parent; 396 396 char mtmp_pl[MLXSW_REG_MTMP_LEN]; 397 397 u16 index;
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
··· 615 615 static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, 616 616 int *temperature) 617 617 { 618 - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; 618 + struct iwl_mvm *mvm = thermal_zone_device_priv(device); 619 619 int ret; 620 620 int temp; 621 621 ··· 641 641 static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, 642 642 int trip, int temp) 643 643 { 644 - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; 644 + struct iwl_mvm *mvm = thermal_zone_device_priv(device); 645 645 struct iwl_mvm_thermal_device *tzone; 646 646 int ret; 647 647
+3 -16
drivers/platform/x86/acerhdf.c
··· 79 79 static unsigned int fanstate = ACERHDF_FAN_AUTO; 80 80 static char force_bios[16]; 81 81 static char force_product[16]; 82 - static unsigned int prev_interval; 83 82 static struct thermal_zone_device *thz_dev; 84 83 static struct thermal_cooling_device *cl_dev; 85 84 static struct platform_device *acerhdf_dev; ··· 345 346 trips[0].temperature = fanon; 346 347 trips[0].hysteresis = fanon - fanoff; 347 348 348 - if (kernelmode && prev_interval != interval) { 349 + if (kernelmode) { 349 350 if (interval > ACERHDF_MAX_INTERVAL) { 350 351 pr_err("interval too high, set to %d\n", 351 352 ACERHDF_MAX_INTERVAL); 352 353 interval = ACERHDF_MAX_INTERVAL; 353 354 } 355 + 354 356 if (verbose) 355 357 pr_notice("interval changed to: %d\n", interval); 356 - 357 - if (thermal) 358 - thermal->polling_delay_jiffies = 359 - round_jiffies(msecs_to_jiffies(interval * 1000)); 360 - 361 - prev_interval = interval; 362 358 } 363 359 } 364 360 ··· 691 697 if (ret) 692 698 return ret; 693 699 694 - if (strcmp(thz_dev->governor->name, 695 - acerhdf_zone_params.governor_name)) { 696 - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", 697 - acerhdf_zone_params.governor_name); 698 - return -EINVAL; 699 - } 700 - 701 700 return 0; 702 701 } 703 702 ··· 788 801 .get = param_get_uint, 789 802 }; 790 803 791 - module_param_cb(interval, &interval_ops, &interval, 0600); 804 + module_param_cb(interval, &interval_ops, &interval, 0000); 792 805 MODULE_PARM_DESC(interval, "Polling interval of temperature check");
+1 -1
drivers/power/supply/power_supply_core.c
··· 1142 1142 int ret; 1143 1143 1144 1144 WARN_ON(tzd == NULL); 1145 - psy = tzd->devdata; 1145 + psy = thermal_zone_device_priv(tzd); 1146 1146 ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); 1147 1147 if (ret) 1148 1148 return ret;
+1 -1
drivers/regulator/max8973-regulator.c
··· 436 436 437 437 static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *temp) 438 438 { 439 - struct max8973_chip *mchip = tz->devdata; 439 + struct max8973_chip *mchip = thermal_zone_device_priv(tz); 440 440 unsigned int val; 441 441 int ret; 442 442
+2 -2
drivers/thermal/amlogic_thermal.c
··· 181 181 static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 182 182 { 183 183 unsigned int tval; 184 - struct amlogic_thermal *pdata = tz->devdata; 184 + struct amlogic_thermal *pdata = thermal_zone_device_priv(tz); 185 185 186 186 if (!pdata) 187 187 return -EINVAL; ··· 285 285 return ret; 286 286 } 287 287 288 - if (devm_thermal_add_hwmon_sysfs(pdata->tzd)) 288 + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, pdata->tzd)) 289 289 dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); 290 290 291 291 ret = amlogic_thermal_initialize(pdata);
+4 -10
drivers/thermal/armada_thermal.c
··· 360 360 * we must absolutely wait for the sensor validity bit to ensure we read 361 361 * actual data. 362 362 */ 363 - if (armada_wait_sensor_validity(priv)) { 364 - dev_err(priv->dev, 365 - "Temperature sensor reading not valid\n"); 363 + if (armada_wait_sensor_validity(priv)) 366 364 return -EIO; 367 - } 368 365 369 366 return 0; 370 367 } ··· 395 398 static int armada_get_temp_legacy(struct thermal_zone_device *thermal, 396 399 int *temp) 397 400 { 398 - struct armada_thermal_priv *priv = thermal->devdata; 401 + struct armada_thermal_priv *priv = thermal_zone_device_priv(thermal); 399 402 int ret; 400 403 401 404 /* Valid check */ 402 - if (!armada_is_valid(priv)) { 403 - dev_err(priv->dev, 404 - "Temperature sensor reading not valid\n"); 405 + if (!armada_is_valid(priv)) 405 406 return -EIO; 406 - } 407 407 408 408 /* Do the actual reading */ 409 409 ret = armada_read_sensor(priv, temp); ··· 414 420 415 421 static int armada_get_temp(struct thermal_zone_device *tz, int *temp) 416 422 { 417 - struct armada_thermal_sensor *sensor = tz->devdata; 423 + struct armada_thermal_sensor *sensor = thermal_zone_device_priv(tz); 418 424 struct armada_thermal_priv *priv = sensor->priv; 419 425 int ret; 420 426
+1 -2
drivers/thermal/broadcom/bcm2711_thermal.c
··· 33 33 34 34 static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) 35 35 { 36 - struct bcm2711_thermal_priv *priv = tz->devdata; 36 + struct bcm2711_thermal_priv *priv = thermal_zone_device_priv(tz); 37 37 int slope = thermal_zone_get_slope(tz); 38 38 int offset = thermal_zone_get_offset(tz); 39 39 u32 val; ··· 98 98 99 99 priv->thermal = thermal; 100 100 101 - thermal->tzp->no_hwmon = false; 102 101 return thermal_add_hwmon_sysfs(thermal); 103 102 } 104 103
+1 -2
drivers/thermal/broadcom/bcm2835_thermal.c
··· 90 90 91 91 static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 92 92 { 93 - struct bcm2835_thermal_data *data = tz->devdata; 93 + struct bcm2835_thermal_data *data = thermal_zone_device_priv(tz); 94 94 u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT); 95 95 96 96 if (!(val & BCM2835_TS_TSENSSTAT_VALID)) ··· 267 267 * Thermal_zone doesn't enable hwmon as default, 268 268 * enable it here 269 269 */ 270 - tz->tzp->no_hwmon = false; 271 270 err = thermal_add_hwmon_sysfs(tz); 272 271 if (err) 273 272 goto err_tz;
+3 -5
drivers/thermal/broadcom/brcmstb_thermal.c
··· 152 152 153 153 static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) 154 154 { 155 - struct brcmstb_thermal_priv *priv = tz->devdata; 155 + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); 156 156 u32 val; 157 157 long t; 158 158 159 159 val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); 160 160 161 - if (!(val & AVS_TMON_STATUS_valid_msk)) { 162 - dev_err(priv->dev, "reading not valid\n"); 161 + if (!(val & AVS_TMON_STATUS_valid_msk)) 163 162 return -EIO; 164 - } 165 163 166 164 val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; 167 165 ··· 260 262 261 263 static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high) 262 264 { 263 - struct brcmstb_thermal_priv *priv = tz->devdata; 265 + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); 264 266 265 267 dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); 266 268
+1 -1
drivers/thermal/broadcom/ns-thermal.c
··· 16 16 17 17 static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 18 18 { 19 - void __iomem *pvtmon = tz->devdata; 19 + void __iomem *pvtmon = thermal_zone_device_priv(tz); 20 20 int offset = thermal_zone_get_offset(tz); 21 21 int slope = thermal_zone_get_slope(tz); 22 22 u32 val;
+1 -1
drivers/thermal/broadcom/sr-thermal.c
··· 32 32 33 33 static int sr_get_temp(struct thermal_zone_device *tz, int *temp) 34 34 { 35 - struct sr_tmon *tmon = tz->devdata; 35 + struct sr_tmon *tmon = thermal_zone_device_priv(tz); 36 36 struct sr_thermal *sr_thermal = tmon->priv; 37 37 38 38 *temp = readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id));
+8 -5
drivers/thermal/da9062-thermal.c
··· 41 41 42 42 #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) 43 43 44 + static unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; 45 + 44 46 struct da9062_thermal_config { 45 47 const char *name; 46 48 }; ··· 97 95 thermal_zone_device_update(thermal->zone, 98 96 THERMAL_EVENT_UNSPECIFIED); 99 97 100 - delay = thermal->zone->passive_delay_jiffies; 98 + /* 99 + * pp_tmp is between 1s and 10s, so we can round the jiffies 100 + */ 101 + delay = round_jiffies(msecs_to_jiffies(pp_tmp)); 101 102 queue_delayed_work(system_freezable_wq, &thermal->work, delay); 102 103 return; 103 104 } ··· 128 123 static int da9062_thermal_get_temp(struct thermal_zone_device *z, 129 124 int *temp) 130 125 { 131 - struct da9062_thermal *thermal = z->devdata; 126 + struct da9062_thermal *thermal = thermal_zone_device_priv(z); 132 127 133 128 mutex_lock(&thermal->lock); 134 129 *temp = thermal->temperature; ··· 160 155 { 161 156 struct da9062 *chip = dev_get_drvdata(pdev->dev.parent); 162 157 struct da9062_thermal *thermal; 163 - unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; 164 158 const struct of_device_id *match; 165 159 int ret = 0; 166 160 ··· 212 208 } 213 209 214 210 dev_dbg(&pdev->dev, 215 - "TJUNC temperature polling period set at %d ms\n", 216 - jiffies_to_msecs(thermal->zone->passive_delay_jiffies)); 211 + "TJUNC temperature polling period set at %d ms\n", pp_tmp); 217 212 218 213 ret = platform_get_irq_byname(pdev, "THERMAL"); 219 214 if (ret < 0)
+1 -1
drivers/thermal/db8500_thermal.c
··· 60 60 /* Callback to get current temperature */ 61 61 static int db8500_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 62 62 { 63 - struct db8500_thermal_zone *th = tz->devdata; 63 + struct db8500_thermal_zone *th = thermal_zone_device_priv(tz); 64 64 65 65 /* 66 66 * TODO: There is no PRCMU interface to get temperature data currently,
+2 -5
drivers/thermal/dove_thermal.c
··· 87 87 int *temp) 88 88 { 89 89 unsigned long reg; 90 - struct dove_thermal_priv *priv = thermal->devdata; 90 + struct dove_thermal_priv *priv = thermal_zone_device_priv(thermal); 91 91 92 92 /* Valid check */ 93 93 reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG); 94 - if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) { 95 - dev_err(&thermal->device, 96 - "Temperature sensor reading not valid\n"); 94 + if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) 97 95 return -EIO; 98 - } 99 96 100 97 /* 101 98 * Calculate temperature. According to Marvell internal
+1 -4
drivers/thermal/hisi_thermal.c
··· 431 431 432 432 static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 433 433 { 434 - struct hisi_thermal_sensor *sensor = tz->devdata; 434 + struct hisi_thermal_sensor *sensor = thermal_zone_device_priv(tz); 435 435 struct hisi_thermal_data *data = sensor->data; 436 436 437 437 *temp = data->ops->get_temp(sensor); 438 - 439 - dev_dbg(&data->pdev->dev, "tzd=%p, id=%d, temp=%d, thres=%d\n", 440 - sensor->tzd, sensor->id, *temp, sensor->thres_temp); 441 438 442 439 return 0; 443 440 }
+2 -2
drivers/thermal/imx8mm_thermal.c
··· 141 141 142 142 static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) 143 143 { 144 - struct tmu_sensor *sensor = tz->devdata; 144 + struct tmu_sensor *sensor = thermal_zone_device_priv(tz); 145 145 struct imx8mm_tmu *tmu = sensor->priv; 146 146 147 147 return tmu->socdata->get_temp(sensor, temp); ··· 343 343 } 344 344 tmu->sensors[i].hw_id = i; 345 345 346 - if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd)) 346 + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, tmu->sensors[i].tzd)) 347 347 dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); 348 348 } 349 349
+3 -6
drivers/thermal/imx_sc_thermal.c
··· 46 46 { 47 47 struct imx_sc_msg_misc_get_temp msg; 48 48 struct imx_sc_rpc_msg *hdr = &msg.hdr; 49 - struct imx_sc_sensor *sensor = tz->devdata; 49 + struct imx_sc_sensor *sensor = thermal_zone_device_priv(tz); 50 50 int ret; 51 51 52 52 msg.data.req.resource_id = sensor->resource_id; ··· 58 58 hdr->size = 2; 59 59 60 60 ret = imx_scu_call_rpc(thermal_ipc_handle, &msg, true); 61 - if (ret) { 62 - dev_err(&sensor->tzd->device, "read temp sensor %d failed, ret %d\n", 63 - sensor->resource_id, ret); 61 + if (ret) 64 62 return ret; 65 - } 66 63 67 64 *temp = msg.data.resp.celsius * 1000 + msg.data.resp.tenths * 100; 68 65 ··· 116 119 return ret; 117 120 } 118 121 119 - if (devm_thermal_add_hwmon_sysfs(sensor->tzd)) 122 + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd)) 120 123 dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); 121 124 } 122 125
+12 -35
drivers/thermal/imx_thermal.c
··· 252 252 253 253 static int imx_get_temp(struct thermal_zone_device *tz, int *temp) 254 254 { 255 - struct imx_thermal_data *data = tz->devdata; 255 + struct imx_thermal_data *data = thermal_zone_device_priv(tz); 256 256 const struct thermal_soc_data *soc_data = data->socdata; 257 257 struct regmap *map = data->tempmon; 258 258 unsigned int n_meas; ··· 265 265 266 266 regmap_read(map, soc_data->temp_data, &val); 267 267 268 - if ((val & soc_data->temp_valid_mask) == 0) { 269 - dev_dbg(&tz->device, "temp measurement never finished\n"); 268 + if ((val & soc_data->temp_valid_mask) == 0) 270 269 return -EAGAIN; 271 - } 272 270 273 271 n_meas = (val & soc_data->temp_value_mask) 274 272 >> soc_data->temp_value_shift; ··· 285 287 if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature && 286 288 *temp < trips[IMX_TRIP_PASSIVE].temperature) { 287 289 imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature); 288 - dev_dbg(&tz->device, "thermal alarm off: T < %d\n", 290 + dev_dbg(data->dev, "thermal alarm off: T < %d\n", 289 291 data->alarm_temp / 1000); 290 292 } 291 293 } 292 294 293 295 if (*temp != data->last_temp) { 294 - dev_dbg(&tz->device, "millicelsius: %d\n", *temp); 296 + dev_dbg(data->dev, "millicelsius: %d\n", *temp); 295 297 data->last_temp = *temp; 296 298 } 297 299 ··· 309 311 static int imx_change_mode(struct thermal_zone_device *tz, 310 312 enum thermal_device_mode mode) 311 313 { 312 - struct imx_thermal_data *data = tz->devdata; 314 + struct imx_thermal_data *data = thermal_zone_device_priv(tz); 313 315 314 316 if (mode == THERMAL_DEVICE_ENABLED) { 315 317 pm_runtime_get(data->dev); ··· 340 342 static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, 341 343 int temp) 342 344 { 343 - struct imx_thermal_data *data = tz->devdata; 345 + struct imx_thermal_data *data = thermal_zone_device_priv(tz); 344 346 int ret; 345 347 346 348 ret = pm_runtime_resume_and_get(data->dev); ··· 367 369 static int imx_bind(struct thermal_zone_device *tz, 368 370 struct thermal_cooling_device *cdev) 369 371 { 370 - int ret; 371 - 372 - ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, 373 - THERMAL_NO_LIMIT, 374 - THERMAL_NO_LIMIT, 375 - THERMAL_WEIGHT_DEFAULT); 376 - if (ret) { 377 - dev_err(&tz->device, 378 - "binding zone %s with cdev %s failed:%d\n", 379 - tz->type, cdev->type, ret); 380 - return ret; 381 - } 382 - 383 - return 0; 372 + return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, 373 + THERMAL_NO_LIMIT, 374 + THERMAL_NO_LIMIT, 375 + THERMAL_WEIGHT_DEFAULT); 384 376 } 385 377 386 378 static int imx_unbind(struct thermal_zone_device *tz, 387 379 struct thermal_cooling_device *cdev) 388 380 { 389 - int ret; 390 - 391 - ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); 392 - if (ret) { 393 - dev_err(&tz->device, 394 - "unbinding zone %s with cdev %s failed:%d\n", 395 - tz->type, cdev->type, ret); 396 - return ret; 397 - } 398 - 399 - return 0; 381 + return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); 400 382 } 401 383 402 384 static struct thermal_zone_device_ops imx_tz_ops = { ··· 538 560 { 539 561 struct imx_thermal_data *data = dev; 540 562 541 - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", 542 - data->alarm_temp / 1000); 563 + dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000); 543 564 544 565 thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); 545 566
+1 -1
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
··· 497 497 static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, 498 498 enum thermal_device_mode mode) 499 499 { 500 - struct int3400_thermal_priv *priv = thermal->devdata; 500 + struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal); 501 501 int result = 0; 502 502 503 503 if (!priv)
+2 -2
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
··· 14 14 static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, 15 15 int *temp) 16 16 { 17 - struct int34x_thermal_zone *d = zone->devdata; 17 + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); 18 18 unsigned long long tmp; 19 19 acpi_status status; 20 20 ··· 41 41 static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, 42 42 int trip, int temp) 43 43 { 44 - struct int34x_thermal_zone *d = zone->devdata; 44 + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); 45 45 char name[] = {'P', 'A', 'T', '0' + trip, '\0'}; 46 46 acpi_status status; 47 47
+2 -2
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
··· 135 135 136 136 static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) 137 137 { 138 - struct proc_thermal_pci *pci_info = tzd->devdata; 138 + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); 139 139 u32 _temp; 140 140 141 141 proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_PKG_TEMP, &_temp); ··· 146 146 147 147 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) 148 148 { 149 - struct proc_thermal_pci *pci_info = tzd->devdata; 149 + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); 150 150 int tjmax, _temp; 151 151 152 152 if (temp <= 0) {
+1 -1
drivers/thermal/intel/intel_pch_thermal.c
··· 119 119 120 120 static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) 121 121 { 122 - struct pch_thermal_device *ptd = tzd->devdata; 122 + struct pch_thermal_device *ptd = thermal_zone_device_priv(tzd); 123 123 124 124 *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); 125 125 return 0;
+3 -3
drivers/thermal/intel/intel_quark_dts_thermal.c
··· 120 120 static int soc_dts_enable(struct thermal_zone_device *tzd) 121 121 { 122 122 u32 out; 123 - struct soc_sensor_entry *aux_entry = tzd->devdata; 123 + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); 124 124 int ret; 125 125 126 126 ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, ··· 148 148 static int soc_dts_disable(struct thermal_zone_device *tzd) 149 149 { 150 150 u32 out; 151 - struct soc_sensor_entry *aux_entry = tzd->devdata; 151 + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); 152 152 int ret; 153 153 154 154 ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, ··· 250 250 static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, 251 251 int temp) 252 252 { 253 - return update_trip_temp(tzd->devdata, trip, temp); 253 + return update_trip_temp(thermal_zone_device_priv(tzd), trip, temp); 254 254 } 255 255 256 256 static int sys_get_curr_temp(struct thermal_zone_device *tzd,
+5 -8
drivers/thermal/intel/intel_soc_dts_iosf.c
··· 54 54 struct intel_soc_dts_sensor_entry *dts; 55 55 struct intel_soc_dts_sensors *sensors; 56 56 57 - dts = tzd->devdata; 57 + dts = thermal_zone_device_priv(tzd); 58 58 sensors = dts->sensors; 59 59 mutex_lock(&sensors->dts_update_lock); 60 60 status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ··· 168 168 static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, 169 169 int temp) 170 170 { 171 - struct intel_soc_dts_sensor_entry *dts = tzd->devdata; 171 + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); 172 172 struct intel_soc_dts_sensors *sensors = dts->sensors; 173 173 int status; 174 174 ··· 176 176 return -EINVAL; 177 177 178 178 mutex_lock(&sensors->dts_update_lock); 179 - status = update_trip_temp(tzd->devdata, trip, temp, 179 + status = update_trip_temp(dts, trip, temp, 180 180 dts->trip_types[trip]); 181 181 mutex_unlock(&sensors->dts_update_lock); 182 182 ··· 186 186 static int sys_get_trip_type(struct thermal_zone_device *tzd, 187 187 int trip, enum thermal_trip_type *type) 188 188 { 189 - struct intel_soc_dts_sensor_entry *dts; 190 - 191 - dts = tzd->devdata; 189 + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); 192 190 193 191 *type = dts->trip_types[trip]; 194 192 ··· 198 200 { 199 201 int status; 200 202 u32 out; 201 - struct intel_soc_dts_sensor_entry *dts; 203 + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); 202 204 struct intel_soc_dts_sensors *sensors; 203 205 unsigned long raw; 204 206 205 - dts = tzd->devdata; 206 207 sensors = dts->sensors; 207 208 status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, 208 209 SOC_DTS_OFFSET_TEMP, &out);
+2 -2
drivers/thermal/intel/x86_pkg_temp_thermal.c
··· 107 107 108 108 static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) 109 109 { 110 - struct zone_device *zonedev = tzd->devdata; 110 + struct zone_device *zonedev = thermal_zone_device_priv(tzd); 111 111 int val; 112 112 113 113 val = intel_tcc_get_temp(zonedev->cpu, true); ··· 122 122 static int 123 123 sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) 124 124 { 125 - struct zone_device *zonedev = tzd->devdata; 125 + struct zone_device *zonedev = thermal_zone_device_priv(tzd); 126 126 u32 l, h, mask, shift, intr; 127 127 int tj_max, ret; 128 128
+2 -2
drivers/thermal/k3_bandgap.c
··· 141 141 142 142 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 143 143 { 144 - struct k3_thermal_data *data = tz->devdata; 144 + struct k3_thermal_data *data = thermal_zone_device_priv(tz); 145 145 int ret = 0; 146 146 147 147 ret = k3_bgp_read_temp(data, temp); ··· 222 222 goto err_alloc; 223 223 } 224 224 225 - if (devm_thermal_add_hwmon_sysfs(data[id].tzd)) 225 + if (devm_thermal_add_hwmon_sysfs(dev, data[id].tzd)) 226 226 dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); 227 227 } 228 228
+1 -1
drivers/thermal/k3_j72xx_bandgap.c
··· 248 248 /* Get temperature callback function for thermal zone */ 249 249 static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 250 250 { 251 - return k3_bgp_read_temp(tz->devdata, temp); 251 + return k3_bgp_read_temp(thermal_zone_device_priv(tz), temp); 252 252 } 253 253 254 254 static const struct thermal_zone_device_ops k3_of_thermal_ops = {
+2 -5
drivers/thermal/kirkwood_thermal.c
··· 27 27 int *temp) 28 28 { 29 29 unsigned long reg; 30 - struct kirkwood_thermal_priv *priv = thermal->devdata; 30 + struct kirkwood_thermal_priv *priv = thermal_zone_device_priv(thermal); 31 31 32 32 reg = readl_relaxed(priv->sensor); 33 33 34 34 /* Valid check */ 35 35 if (!((reg >> KIRKWOOD_THERMAL_VALID_OFFSET) & 36 - KIRKWOOD_THERMAL_VALID_MASK)) { 37 - dev_err(&thermal->device, 38 - "Temperature sensor reading not valid\n"); 36 + KIRKWOOD_THERMAL_VALID_MASK)) 39 37 return -EIO; 40 - } 41 38 42 39 /* 43 40 * Calculate temperature. According to Marvell internal
+2 -4
drivers/thermal/max77620_thermal.c
··· 46 46 47 47 static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int *temp) 48 48 { 49 - struct max77620_therm_info *mtherm = tz->devdata; 49 + struct max77620_therm_info *mtherm = thermal_zone_device_priv(tz); 50 50 unsigned int val; 51 51 int ret; 52 52 53 53 ret = regmap_read(mtherm->rmap, MAX77620_REG_STATLBT, &val); 54 - if (ret < 0) { 55 - dev_err(mtherm->dev, "Failed to read STATLBT: %d\n", ret); 54 + if (ret < 0) 56 55 return ret; 57 - } 58 56 59 57 if (val & MAX77620_IRQ_TJALRM2_MASK) 60 58 *temp = MAX77620_TJALARM2_TEMP;
+2 -2
drivers/thermal/mediatek/auxadc_thermal.c
··· 763 763 764 764 static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) 765 765 { 766 - struct mtk_thermal *mt = tz->devdata; 766 + struct mtk_thermal *mt = thermal_zone_device_priv(tz); 767 767 int i; 768 768 int tempmax = INT_MIN; 769 769 ··· 1210 1210 goto err_disable_clk_peri_therm; 1211 1211 } 1212 1212 1213 - ret = devm_thermal_add_hwmon_sysfs(tzdev); 1213 + ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev); 1214 1214 if (ret) 1215 1215 dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs"); 1216 1216
+6 -4
drivers/thermal/mediatek/lvts_thermal.c
··· 252 252 253 253 static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) 254 254 { 255 - struct lvts_sensor *lvts_sensor = tz->devdata; 255 + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); 256 256 void __iomem *msr = lvts_sensor->msr; 257 257 u32 value; 258 258 ··· 290 290 291 291 static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) 292 292 { 293 - struct lvts_sensor *lvts_sensor = tz->devdata; 293 + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); 294 294 void __iomem *base = lvts_sensor->base; 295 295 u32 raw_low = lvts_temp_to_raw(low); 296 296 u32 raw_high = lvts_temp_to_raw(high); ··· 305 305 * 14-0 : Raw temperature for threshold 306 306 */ 307 307 if (low != -INT_MAX) { 308 - dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low); 308 + pr_debug("%s: Setting low limit temperature interrupt: %d\n", 309 + thermal_zone_device_type(tz), low); 309 310 writel(raw_low, LVTS_H2NTHRE(base)); 310 311 } 311 312 ··· 319 318 * 320 319 * 14-0 : Raw temperature for threshold 321 320 */ 322 - dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high); 321 + pr_debug("%s: Setting high limit temperature interrupt: %d\n", 322 + thermal_zone_device_type(tz), high); 323 323 writel(raw_high, LVTS_HTHRE(base)); 324 324 325 325 return 0;
+3 -3
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
··· 360 360 361 361 static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp) 362 362 { 363 - struct adc_tm5_channel *channel = tz->devdata; 363 + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); 364 364 int ret; 365 365 366 366 if (!channel || !channel->iio) ··· 642 642 643 643 static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int high) 644 644 { 645 - struct adc_tm5_channel *channel = tz->devdata; 645 + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); 646 646 struct adc_tm5_chip *chip; 647 647 int ret; 648 648 ··· 689 689 return PTR_ERR(tzd); 690 690 } 691 691 adc_tm->channels[i].tzd = tzd; 692 - if (devm_thermal_add_hwmon_sysfs(tzd)) 692 + if (devm_thermal_add_hwmon_sysfs(adc_tm->dev, tzd)) 693 693 dev_warn(adc_tm->dev, 694 694 "Failed to add hwmon sysfs attributes\n"); 695 695 }
+3 -3
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
··· 187 187 188 188 static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp) 189 189 { 190 - struct qpnp_tm_chip *chip = tz->devdata; 190 + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); 191 191 int ret, mili_celsius; 192 192 193 193 if (!temp) ··· 265 265 266 266 static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) 267 267 { 268 - struct qpnp_tm_chip *chip = tz->devdata; 268 + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); 269 269 struct thermal_trip trip; 270 270 int ret; 271 271 ··· 459 459 return ret; 460 460 } 461 461 462 - if (devm_thermal_add_hwmon_sysfs(chip->tz_dev)) 462 + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev)) 463 463 dev_warn(&pdev->dev, 464 464 "Failed to add hwmon sysfs attributes\n"); 465 465
+3 -3
drivers/thermal/qcom/tsens.c
··· 673 673 674 674 static int tsens_set_trips(struct thermal_zone_device *tz, int low, int high) 675 675 { 676 - struct tsens_sensor *s = tz->devdata; 676 + struct tsens_sensor *s = thermal_zone_device_priv(tz); 677 677 struct tsens_priv *priv = s->priv; 678 678 struct device *dev = priv->dev; 679 679 struct tsens_irq_data d; ··· 1057 1057 1058 1058 static int tsens_get_temp(struct thermal_zone_device *tz, int *temp) 1059 1059 { 1060 - struct tsens_sensor *s = tz->devdata; 1060 + struct tsens_sensor *s = thermal_zone_device_priv(tz); 1061 1061 struct tsens_priv *priv = s->priv; 1062 1062 1063 1063 return priv->ops->get_temp(s, temp); ··· 1189 1189 if (priv->ops->enable) 1190 1190 priv->ops->enable(priv, i); 1191 1191 1192 - if (devm_thermal_add_hwmon_sysfs(tzd)) 1192 + if (devm_thermal_add_hwmon_sysfs(priv->dev, tzd)) 1193 1193 dev_warn(priv->dev, 1194 1194 "Failed to add hwmon sysfs attributes\n"); 1195 1195 }
+2 -2
drivers/thermal/qoriq_thermal.c
··· 83 83 84 84 static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) 85 85 { 86 - struct qoriq_sensor *qsensor = tz->devdata; 86 + struct qoriq_sensor *qsensor = thermal_zone_device_priv(tz); 87 87 struct qoriq_tmu_data *qdata = qoriq_sensor_to_data(qsensor); 88 88 u32 val; 89 89 /* ··· 157 157 return ret; 158 158 } 159 159 160 - if (devm_thermal_add_hwmon_sysfs(tzd)) 160 + if (devm_thermal_add_hwmon_sysfs(dev, tzd)) 161 161 dev_warn(dev, 162 162 "Failed to add hwmon sysfs attributes\n"); 163 163
+2 -3
drivers/thermal/rcar_gen3_thermal.c
··· 167 167 168 168 static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 169 169 { 170 - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; 170 + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); 171 171 int mcelsius, val; 172 172 int reg; 173 173 ··· 206 206 207 207 static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) 208 208 { 209 - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; 209 + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); 210 210 u32 irqmsk = 0; 211 211 212 212 if (low != -INT_MAX) { ··· 527 527 } 528 528 tsc->zone = zone; 529 529 530 - tsc->zone->tzp->no_hwmon = false; 531 530 ret = thermal_add_hwmon_sysfs(tsc->zone); 532 531 if (ret) 533 532 goto error_unregister;
+1 -7
drivers/thermal/rcar_thermal.c
··· 101 101 list_for_each_entry(pos, &common->head, list) 102 102 103 103 #define MCELSIUS(temp) ((temp) * 1000) 104 - #define rcar_zone_to_priv(zone) ((zone)->devdata) 105 104 #define rcar_priv_to_dev(priv) ((priv)->common->dev) 106 105 #define rcar_has_irq_support(priv) ((priv)->common->base) 107 106 #define rcar_id_to_shift(priv) ((priv)->id * 8) ··· 272 273 273 274 static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) 274 275 { 275 - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); 276 + struct rcar_thermal_priv *priv = thermal_zone_device_priv(zone); 276 277 277 278 return rcar_thermal_get_current_temp(priv, temp); 278 279 } ··· 509 510 } 510 511 511 512 if (chip->use_of_thermal) { 512 - /* 513 - * thermal_zone doesn't enable hwmon as default, 514 - * but, enable it here to keep compatible 515 - */ 516 - priv->zone->tzp->no_hwmon = false; 517 513 ret = thermal_add_hwmon_sysfs(priv->zone); 518 514 if (ret) 519 515 goto error_unregister;
+2 -6
drivers/thermal/rockchip_thermal.c
··· 1213 1213 1214 1214 static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) 1215 1215 { 1216 - struct rockchip_thermal_sensor *sensor = tz->devdata; 1216 + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); 1217 1217 struct rockchip_thermal_data *thermal = sensor->thermal; 1218 1218 const struct rockchip_tsadc_chip *tsadc = thermal->chip; 1219 1219 ··· 1226 1226 1227 1227 static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) 1228 1228 { 1229 - struct rockchip_thermal_sensor *sensor = tz->devdata; 1229 + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); 1230 1230 struct rockchip_thermal_data *thermal = sensor->thermal; 1231 1231 const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; 1232 1232 int retval; 1233 1233 1234 1234 retval = tsadc->get_temp(&tsadc->table, 1235 1235 sensor->id, thermal->regs, out_temp); 1236 - dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", 1237 - sensor->id, *out_temp, retval); 1238 - 1239 1236 return retval; 1240 1237 } 1241 1238 ··· 1451 1454 1452 1455 for (i = 0; i < thermal->chip->chn_num; i++) { 1453 1456 rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); 1454 - thermal->sensors[i].tzd->tzp->no_hwmon = false; 1455 1457 error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd); 1456 1458 if (error) 1457 1459 dev_warn(&pdev->dev,
+1 -2
drivers/thermal/rzg2l_thermal.c
··· 75 75 76 76 static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 77 77 { 78 - struct rzg2l_thermal_priv *priv = tz->devdata; 78 + struct rzg2l_thermal_priv *priv = thermal_zone_device_priv(tz); 79 79 u32 result = 0, dsensor, ts_code_ave; 80 80 int val, i; 81 81 ··· 216 216 } 217 217 218 218 priv->zone = zone; 219 - priv->zone->tzp->no_hwmon = false; 220 219 ret = thermal_add_hwmon_sysfs(priv->zone); 221 220 if (ret) 222 221 goto err;
+2 -2
drivers/thermal/samsung/exynos_tmu.c
··· 645 645 646 646 static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) 647 647 { 648 - struct exynos_tmu_data *data = tz->devdata; 648 + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); 649 649 int value, ret = 0; 650 650 651 651 if (!data || !data->tmu_read) ··· 723 723 724 724 static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp) 725 725 { 726 - struct exynos_tmu_data *data = tz->devdata; 726 + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); 727 727 int ret = -EINVAL; 728 728 729 729 if (data->soc == SOC_ARCH_EXYNOS4210)
+5 -5
drivers/thermal/spear_thermal.c
··· 31 31 static inline int thermal_get_temp(struct thermal_zone_device *thermal, 32 32 int *temp) 33 33 { 34 - struct spear_thermal_dev *stdev = thermal->devdata; 34 + struct spear_thermal_dev *stdev = thermal_zone_device_priv(thermal); 35 35 36 36 /* 37 37 * Data are ready to be read after 628 usec from POWERDOWN signal ··· 48 48 static int __maybe_unused spear_thermal_suspend(struct device *dev) 49 49 { 50 50 struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); 51 - struct spear_thermal_dev *stdev = spear_thermal->devdata; 51 + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); 52 52 unsigned int actual_mask = 0; 53 53 54 54 /* Disable SPEAr Thermal Sensor */ ··· 64 64 static int __maybe_unused spear_thermal_resume(struct device *dev) 65 65 { 66 66 struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); 67 - struct spear_thermal_dev *stdev = spear_thermal->devdata; 67 + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); 68 68 unsigned int actual_mask = 0; 69 69 int ret = 0; 70 70 ··· 137 137 138 138 platform_set_drvdata(pdev, spear_thermal); 139 139 140 - dev_info(&spear_thermal->device, "Thermal Sensor Loaded at: 0x%p.\n", 140 + dev_info(&pdev->dev, "Thermal Sensor Loaded at: 0x%p.\n", 141 141 stdev->thermal_base); 142 142 143 143 return 0; ··· 154 154 { 155 155 unsigned int actual_mask = 0; 156 156 struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); 157 - struct spear_thermal_dev *stdev = spear_thermal->devdata; 157 + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); 158 158 159 159 thermal_zone_device_unregister(spear_thermal); 160 160
+1 -1
drivers/thermal/sprd_thermal.c
··· 206 206 207 207 static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) 208 208 { 209 - struct sprd_thermal_sensor *sen = tz->devdata; 209 + struct sprd_thermal_sensor *sen = thermal_zone_device_priv(tz); 210 210 u32 data; 211 211 212 212 data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) &
+1 -4
drivers/thermal/st/st_thermal.c
··· 108 108 /* Callback to get temperature from HW*/ 109 109 static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) 110 110 { 111 - struct st_thermal_sensor *sensor = th->devdata; 112 - struct device *dev = sensor->dev; 111 + struct st_thermal_sensor *sensor = thermal_zone_device_priv(th); 113 112 unsigned int temp; 114 113 unsigned int overflow; 115 114 int ret; ··· 125 126 126 127 temp += sensor->cdata->temp_adjust_val; 127 128 temp = mcelsius(temp); 128 - 129 - dev_dbg(dev, "temperature: %d\n", temp); 130 129 131 130 *temperature = temp; 132 131
+2 -2
drivers/thermal/st/stm_thermal.c
··· 303 303 304 304 static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) 305 305 { 306 - struct stm_thermal_sensor *sensor = tz->devdata; 306 + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); 307 307 u32 itr1, th; 308 308 int ret; 309 309 ··· 351 351 /* Callback to get temperature from HW */ 352 352 static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 353 353 { 354 - struct stm_thermal_sensor *sensor = tz->devdata; 354 + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); 355 355 u32 periods; 356 356 int freqM, ret; 357 357
+2 -2
drivers/thermal/sun8i_thermal.c
··· 110 110 111 111 static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) 112 112 { 113 - struct tsensor *s = tz->devdata; 113 + struct tsensor *s = thermal_zone_device_priv(tz); 114 114 struct ths_device *tmdev = s->tmdev; 115 115 int val = 0; 116 116 ··· 475 475 if (IS_ERR(tmdev->sensor[i].tzd)) 476 476 return PTR_ERR(tmdev->sensor[i].tzd); 477 477 478 - if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd)) 478 + if (devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd)) 479 479 dev_warn(tmdev->dev, 480 480 "Failed to add hwmon sysfs attributes\n"); 481 481 }
+3 -3
drivers/thermal/tegra/soctherm.c
··· 423 423 424 424 static int tegra_thermctl_get_temp(struct thermal_zone_device *tz, int *out_temp) 425 425 { 426 - struct tegra_thermctl_zone *zone = tz->devdata; 426 + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); 427 427 u32 val; 428 428 429 429 val = readl(zone->reg); ··· 584 584 585 585 static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) 586 586 { 587 - struct tegra_thermctl_zone *zone = tz->devdata; 587 + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); 588 588 struct tegra_soctherm *ts = zone->ts; 589 589 struct thermal_trip trip; 590 590 const struct tegra_tsensor_group *sg = zone->sg; ··· 658 658 659 659 static int tegra_thermctl_set_trips(struct thermal_zone_device *tz, int lo, int hi) 660 660 { 661 - struct tegra_thermctl_zone *zone = tz->devdata; 661 + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); 662 662 u32 r; 663 663 664 664 thermal_irq_disable(zone);
+4 -2
drivers/thermal/tegra/tegra-bpmp-thermal.c
··· 62 62 63 63 static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) 64 64 { 65 - return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); 65 + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_priv(tz); 66 + 67 + return __tegra_bpmp_thermal_get_temp(zone, out_temp); 66 68 } 67 69 68 70 static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) 69 71 { 70 - struct tegra_bpmp_thermal_zone *zone = tz->devdata; 72 + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_priv(tz); 71 73 struct mrq_thermal_host_to_bpmp_request req; 72 74 struct tegra_bpmp_message msg; 73 75 int err;
+17 -14
drivers/thermal/tegra/tegra30-tsensor.c
··· 160 160 161 161 static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *temp) 162 162 { 163 - const struct tegra_tsensor_channel *tsc = tz->devdata; 163 + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); 164 164 const struct tegra_tsensor *ts = tsc->ts; 165 165 int err, c1, c2, c3, c4, counter; 166 166 u32 val; ··· 218 218 219 219 static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low, int high) 220 220 { 221 - const struct tegra_tsensor_channel *tsc = tz->devdata; 221 + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); 222 222 const struct tegra_tsensor *ts = tsc->ts; 223 223 u32 val; 224 224 ··· 359 359 360 360 tegra_tsensor_get_hw_channel_trips(tzd, &hot_trip, &crit_trip); 361 361 362 - /* prevent potential racing with tegra_tsensor_set_trips() */ 363 - mutex_lock(&tzd->lock); 364 - 365 362 dev_info_once(ts->dev, "ch%u: PMC emergency shutdown trip set to %dC\n", 366 363 id, DIV_ROUND_CLOSEST(crit_trip, 1000)); 367 364 ··· 400 403 val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_HW_FREQ_DIV_EN, 1); 401 404 val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1); 402 405 writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0); 403 - 404 - mutex_unlock(&tzd->lock); 405 406 406 407 err = thermal_zone_device_enable(tzd); 407 408 if (err) { ··· 523 528 return 0; 524 529 } 525 530 526 - if (devm_thermal_add_hwmon_sysfs(tsc->tzd)) 531 + if (devm_thermal_add_hwmon_sysfs(ts->dev, tsc->tzd)) 527 532 dev_warn(ts->dev, "failed to add hwmon sysfs attributes\n"); 528 533 529 534 return 0; ··· 580 585 return err; 581 586 } 582 587 588 + /* 589 + * Enable the channels before setting the interrupt so 590 + * set_trips() can not be called while we are setting up the 591 + * register TSENSOR_SENSOR0_CONFIG1. With this we close a 592 + * potential race window where we are setting up the TH2 and 593 + * the temperature hits TH1 resulting to an update of the 594 + * TSENSOR_SENSOR0_CONFIG1 register in the ISR. 595 + */ 596 + for (i = 0; i < ARRAY_SIZE(ts->ch); i++) { 597 + err = tegra_tsensor_enable_hw_channel(ts, i); 598 + if (err) 599 + return err; 600 + } 601 + 583 602 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, 584 603 tegra_tsensor_isr, IRQF_ONESHOT, 585 604 "tegra_tsensor", ts); 586 605 if (err) 587 606 return dev_err_probe(&pdev->dev, err, 588 607 "failed to request interrupt\n"); 589 - 590 - for (i = 0; i < ARRAY_SIZE(ts->ch); i++) { 591 - err = tegra_tsensor_enable_hw_channel(ts, i); 592 - if (err) 593 - return err; 594 - } 595 608 596 609 return 0; 597 610 }
+3 -4
drivers/thermal/thermal-generic-adc.c
··· 54 54 55 55 static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 56 56 { 57 - struct gadc_thermal_info *gti = tz->devdata; 57 + struct gadc_thermal_info *gti = thermal_zone_device_priv(tz); 58 58 int val; 59 59 int ret; 60 60 61 61 ret = iio_read_channel_processed(gti->channel, &val); 62 - if (ret < 0) { 63 - dev_err(gti->dev, "IIO channel read failed %d\n", ret); 62 + if (ret < 0) 64 63 return ret; 65 - } 64 + 66 65 *temp = gadc_thermal_adc_to_temp(gti, val); 67 66 68 67 return 0;
+18
drivers/thermal/thermal_core.c
··· 1377 1377 } 1378 1378 EXPORT_SYMBOL_GPL(thermal_zone_device_register); 1379 1379 1380 + void *thermal_zone_device_priv(struct thermal_zone_device *tzd) 1381 + { 1382 + return tzd->devdata; 1383 + } 1384 + EXPORT_SYMBOL_GPL(thermal_zone_device_priv); 1385 + 1386 + const char *thermal_zone_device_type(struct thermal_zone_device *tzd) 1387 + { 1388 + return tzd->type; 1389 + } 1390 + EXPORT_SYMBOL_GPL(thermal_zone_device_type); 1391 + 1392 + int thermal_zone_device_id(struct thermal_zone_device *tzd) 1393 + { 1394 + return tzd->id; 1395 + } 1396 + EXPORT_SYMBOL_GPL(thermal_zone_device_id); 1397 + 1380 1398 /** 1381 1399 * thermal_zone_device_unregister - removes the registered thermal zone device 1382 1400 * @tz: the thermal zone device to remove
+3
drivers/thermal/thermal_helpers.c
··· 107 107 *temp = tz->emul_temperature; 108 108 } 109 109 110 + if (ret) 111 + dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret); 112 + 110 113 return ret; 111 114 } 112 115
+5 -4
drivers/thermal/thermal_hwmon.c
··· 17 17 #include <linux/thermal.h> 18 18 19 19 #include "thermal_hwmon.h" 20 + #include "thermal_core.h" 20 21 21 22 /* hwmon sys I/F */ 22 23 /* thermal zone devices with the same type share one hwmon device */ ··· 229 228 hwmon = thermal_hwmon_lookup_by_type(tz); 230 229 if (unlikely(!hwmon)) { 231 230 /* Should never happen... */ 232 - dev_dbg(&tz->device, "hwmon device lookup failed!\n"); 231 + dev_dbg(hwmon->device, "hwmon device lookup failed!\n"); 233 232 return; 234 233 } 235 234 236 235 temp = thermal_hwmon_lookup_temp(hwmon, tz); 237 236 if (unlikely(!temp)) { 238 237 /* Should never happen... */ 239 - dev_dbg(&tz->device, "temperature input lookup failed!\n"); 238 + dev_dbg(hwmon->device, "temperature input lookup failed!\n"); 240 239 return; 241 240 } 242 241 ··· 264 263 thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); 265 264 } 266 265 267 - int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 266 + int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz) 268 267 { 269 268 struct thermal_zone_device **ptr; 270 269 int ret; ··· 281 280 } 282 281 283 282 *ptr = tz; 284 - devres_add(&tz->device, ptr); 283 + devres_add(dev, ptr); 285 284 286 285 return ret; 287 286 }
+2 -2
drivers/thermal/thermal_hwmon.h
··· 17 17 18 18 #ifdef CONFIG_THERMAL_HWMON 19 19 int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); 20 - int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); 20 + int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz); 21 21 void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz); 22 22 #else 23 23 static inline int ··· 27 27 } 28 28 29 29 static inline int 30 - devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) 30 + devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz) 31 31 { 32 32 return 0; 33 33 }
+1 -1
drivers/thermal/thermal_mmio.c
··· 23 23 static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, int *temp) 24 24 { 25 25 int t; 26 - struct thermal_mmio *sensor = tz->devdata; 26 + struct thermal_mmio *sensor = thermal_zone_device_priv(tz); 27 27 28 28 t = sensor->read_mmio(sensor->mmio_base) & sensor->mask; 29 29 t *= sensor->factor;
+5 -5
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
··· 43 43 44 44 thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); 45 45 46 - dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n", 47 - data->ti_thermal->type); 46 + dev_dbg(data->bgp->dev, "updated thermal zone %s\n", 47 + thermal_zone_device_type(data->ti_thermal)); 48 48 } 49 49 50 50 /** ··· 68 68 static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *temp) 69 69 { 70 70 struct thermal_zone_device *pcb_tz = NULL; 71 - struct ti_thermal_data *data = tz->devdata; 71 + struct ti_thermal_data *data = thermal_zone_device_priv(tz); 72 72 struct ti_bandgap *bgp; 73 73 const struct ti_temp_sensor *s; 74 74 int ret, tmp, slope, constant; ··· 109 109 110 110 static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip, enum thermal_trend *trend) 111 111 { 112 - struct ti_thermal_data *data = tz->devdata; 112 + struct ti_thermal_data *data = thermal_zone_device_priv(tz); 113 113 struct ti_bandgap *bgp; 114 114 int id, tr, ret = 0; 115 115 ··· 182 182 ti_bandgap_set_sensor_data(bgp, id, data); 183 183 ti_bandgap_write_update_interval(bgp, data->sensor_id, interval); 184 184 185 - if (devm_thermal_add_hwmon_sysfs(data->ti_thermal)) 185 + if (devm_thermal_add_hwmon_sysfs(bgp->dev, data->ti_thermal)) 186 186 dev_warn(bgp->dev, "failed to add hwmon sysfs attributes\n"); 187 187 188 188 return 0;
+1 -1
drivers/thermal/uniphier_thermal.c
··· 187 187 188 188 static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_temp) 189 189 { 190 - struct uniphier_tm_dev *tdev = tz->devdata; 190 + struct uniphier_tm_dev *tdev = thermal_zone_device_priv(tz); 191 191 struct regmap *map = tdev->regmap; 192 192 int ret; 193 193 u32 temp;
+19
include/linux/thermal.h
··· 365 365 void *, struct thermal_zone_device_ops *, 366 366 struct thermal_zone_params *, int, int); 367 367 368 + void *thermal_zone_device_priv(struct thermal_zone_device *tzd); 369 + const char *thermal_zone_device_type(struct thermal_zone_device *tzd); 370 + int thermal_zone_device_id(struct thermal_zone_device *tzd); 371 + 368 372 int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 369 373 struct thermal_cooling_device *, 370 374 unsigned long, unsigned long, ··· 439 435 static inline int thermal_zone_get_offset( 440 436 struct thermal_zone_device *tz) 441 437 { return -ENODEV; } 438 + 439 + static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz) 440 + { 441 + return NULL; 442 + } 443 + 444 + static inline const char *thermal_zone_device_type(struct thermal_zone_device *tzd) 445 + { 446 + return NULL; 447 + } 448 + 449 + static inline int thermal_zone_device_id(struct thermal_zone_device *tzd) 450 + { 451 + return -ENODEV; 452 + } 442 453 443 454 static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) 444 455 { return -ENODEV; }