Commit 393d0f5c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files
Pull thermal control changes for v6.1-rc1 from Daniel Lezcano:

"- Rework the device tree initialization, convert the drivers to the
   new API and remove the old OF code (Daniel Lezcano)

 - Fix return value to -ENODEV when searching for a specific thermal
   zone which does not exist (Daniel Lezcano)

 - Fix the return value inspection in of_thermal_zone_find() (Dan
   Carpenter)

 - Fix kernel panic when KASAN is enabled as it detects use after
   free when unregistering a thermal zone (Daniel Lezcano)

 - Move the set_trip ops inside the therma sysfs code (Daniel Lezcano)

 - Remove unnecessary error message as it is already showed in the
   underlying function (Jiapeng Chong)

 - Rework the monitoring path and move the locks upper in the call
   stack to fix some potentials race windows (Daniel Lezcano)

 - Fix lockdep_assert() warning introduced by the lock rework (Daniel
   Lezcano)

 - Revert the Mellanox 'hotter thermal zone' feature because it is
   already handled in the thermal framework core code (Daniel Lezcano)"

* tag 'thermal-v6.1-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (46 commits)
  Revert "mlxsw: core: Add the hottest thermal zone detection"
  thermal/core: Fix lockdep_assert() warning
  thermal/core: Move the mutex inside the thermal_zone_device_update() function
  thermal/core: Move the thermal zone lock out of the governors
  thermal/governors: Group the thermal zone lock inside the throttle function
  thermal/core: Rework the monitoring a bit
  thermal/core: Rearm the monitoring only one time
  thermal/drivers/qcom/spmi-adc-tm5: Remove unnecessary print function dev_err()
  thermal/of: Remove old OF code
  thermal/core: Move set_trip_temp ops to the sysfs code
  thermal/drivers/samsung: Switch to new of thermal API
  regulator/drivers/max8976: Switch to new of thermal API
  Input: sun4i-ts - switch to new of thermal API
  iio/drivers/sun4i_gpadc: Switch to new of thermal API
  hwmon/drivers/core: Switch to new of thermal API
  hwmon: pm_bus: core: Switch to new of thermal API
  ata/drivers/ahci_imx: Switch to new of thermal API
  thermal/drivers/ti-soc: Switch to new of API
  thermal/drivers/hisilicon: Switch to new of API
  thermal/drivers/maxim: Switch to new of API
  ...
parents 1c23f9e6 06f36055
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@ patternProperties:
      - polling-delay
      - polling-delay-passive
      - thermal-sensors
      - trips

    additionalProperties: false

+10 −5
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
}

/* SATA AHCI temperature monitor */
static int sata_ahci_read_temperature(void *dev, int *temp)
static int __sata_ahci_read_temperature(void *dev, int *temp)
{
	u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
	u32 str1, str2, str3, str4;
@@ -416,6 +416,11 @@ static int sata_ahci_read_temperature(void *dev, int *temp)
	return 0;
}

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

static ssize_t sata_ahci_show_temp(struct device *dev,
				   struct device_attribute *da,
				   char *buf)
@@ -423,14 +428,14 @@ static ssize_t sata_ahci_show_temp(struct device *dev,
	unsigned int temp = 0;
	int err;

	err = sata_ahci_read_temperature(dev, &temp);
	err = __sata_ahci_read_temperature(dev, &temp);
	if (err < 0)
		return err;

	return sprintf(buf, "%u\n", temp);
}

static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
static const struct thermal_zone_device_ops fsl_sata_ahci_of_thermal_ops = {
	.get_temp = sata_ahci_read_temperature,
};

@@ -1131,7 +1136,7 @@ static int imx_ahci_probe(struct platform_device *pdev)
			ret = PTR_ERR(hwmon_dev);
			goto disable_clk;
		}
		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
		devm_thermal_of_zone_register(hwmon_dev, 0, hwmon_dev,
					      &fsl_sata_ahci_of_thermal_ops);
		dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
	}
+7 −7
Original line number Diff line number Diff line
@@ -151,9 +151,9 @@ static DEFINE_IDA(hwmon_ida);
 * between hwmon and thermal_sys modules.
 */
#ifdef CONFIG_THERMAL_OF
static int hwmon_thermal_get_temp(void *data, int *temp)
static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct hwmon_thermal_data *tdata = data;
	struct hwmon_thermal_data *tdata = tz->devdata;
	struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
	int ret;
	long t;
@@ -168,9 +168,9 @@ static int hwmon_thermal_get_temp(void *data, int *temp)
	return 0;
}

static int hwmon_thermal_set_trips(void *data, int low, int high)
static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{
	struct hwmon_thermal_data *tdata = data;
	struct hwmon_thermal_data *tdata = tz->devdata;
	struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
	const struct hwmon_chip_info *chip = hwdev->chip;
	const struct hwmon_channel_info **info = chip->info;
@@ -203,7 +203,7 @@ static int hwmon_thermal_set_trips(void *data, int low, int high)
	return 0;
}

static const struct thermal_zone_of_device_ops hwmon_thermal_ops = {
static const struct thermal_zone_device_ops hwmon_thermal_ops = {
	.get_temp = hwmon_thermal_get_temp,
	.set_trips = hwmon_thermal_set_trips,
};
@@ -227,7 +227,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index)
	tdata->dev = dev;
	tdata->index = index;

	tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
	tzd = devm_thermal_of_zone_register(dev, index, tdata,
					    &hwmon_thermal_ops);
	if (IS_ERR(tzd)) {
		if (PTR_ERR(tzd) != -ENODEV)
+5 −5
Original line number Diff line number Diff line
@@ -1270,9 +1270,9 @@ struct pmbus_thermal_data {
	struct pmbus_sensor *sensor;
};

static int pmbus_thermal_get_temp(void *data, int *temp)
static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
	struct pmbus_thermal_data *tdata = data;
	struct pmbus_thermal_data *tdata = tz->devdata;
	struct pmbus_sensor *sensor = tdata->sensor;
	struct pmbus_data *pmbus_data = tdata->pmbus_data;
	struct i2c_client *client = to_i2c_client(pmbus_data->dev);
@@ -1296,7 +1296,7 @@ static int pmbus_thermal_get_temp(void *data, int *temp)
	return ret;
}

static const struct thermal_zone_of_device_ops pmbus_thermal_ops = {
static const struct thermal_zone_device_ops pmbus_thermal_ops = {
	.get_temp = pmbus_thermal_get_temp,
};

@@ -1314,7 +1314,7 @@ static int pmbus_thermal_add_sensor(struct pmbus_data *pmbus_data,
	tdata->sensor = sensor;
	tdata->pmbus_data = pmbus_data;

	tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
	tzd = devm_thermal_of_zone_register(dev, index, tdata,
					    &pmbus_thermal_ops);
	/*
	 * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
+7 −7
Original line number Diff line number Diff line
@@ -62,9 +62,9 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)
	}
}

static int scpi_read_temp(void *dev, int *temp)
static int scpi_read_temp(struct thermal_zone_device *tz, int *temp)
{
	struct scpi_thermal_zone *zone = dev;
	struct scpi_thermal_zone *zone = tz->devdata;
	struct scpi_sensors *scpi_sensors = zone->scpi_sensors;
	struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops;
	struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];
@@ -121,7 +121,7 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)
	return sprintf(buf, "%s\n", sensor->info.name);
}

static const struct thermal_zone_of_device_ops scpi_sensor_ops = {
static const struct thermal_zone_device_ops scpi_sensor_ops = {
	.get_temp = scpi_read_temp,
};

@@ -275,7 +275,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)

		zone->sensor_id = i;
		zone->scpi_sensors = scpi_sensors;
		z = devm_thermal_zone_of_sensor_register(dev,
		z = devm_thermal_of_zone_register(dev,
						  sensor->info.sensor_id,
						  zone,
						  &scpi_sensor_ops);
Loading