]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 May 2023 18:46:01 +0000 (11:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 May 2023 18:46:01 +0000 (11:46 -0700)
Pull more thermal control updates from Rafael Wysocki:
 "These are mostly cleanups on top of the previously merged thermal
  control changes plus some driver fixes and the removal of the Intel
  Menlow thermal driver.

  Specifics:

   - Add compatible DT bindings for imx6sll and imx6ul to fix a dtbs
     check warning (Stefan Wahren)

   - Update the example in the DT bindings to reflect changes with the
     ADC node name for QCom TM and TM5 (Marijn Suijten)

   - Fix comments for the cpuidle_cooling_register() function to match
     the function prototype (Chenggang Wang)

   - Fix inconsistent temperature read and some Mediatek variant board
     reboot by reverting a change and handling the temperature
     differently (AngeloGioacchino Del Regno)

   - Fix a memory leak in the initialization error path for the Mediatek
     driver (Kang Chen)

   - Use of_address_to_resource() in the Mediatek driver (Rob Herring)

   - Fix unit address in the QCom tsens driver DT bindings (Krzysztof
     Kozlowski)

   - Clean up the step-wise thermal governor (Zhang Rui)

   - Introduce thermal_zone_device() for accessing the device field of
     struct thermal_zone_device and two drivers use it (Daniel Lezcano)

   - Clean up the ACPI thermal driver a bit (Daniel Lezcano)

   - Delete the thermal driver for Intel Menlow platforms that is not
     expected to have any users (Rafael Wysocki)"

* tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: intel: menlow: Get rid of this driver
  ACPI: thermal: Move to dedicated function sysfs extra attr creation
  ACPI: thermal: Use thermal_zone_device()
  thermal: intel: pch_thermal: Use thermal driver device to write a trace
  thermal: core: Encapsulate tz->device field
  thermal: gov_step_wise: Adjust code logic to match comment
  thermal: gov_step_wise: Delete obsolete comment
  dt-bindings: thermal: qcom-tsens: Correct unit address
  thermal/drivers/mediatek: Use of_address_to_resource()
  thermal/drivers/mediatek: Change clk_prepare_enable to devm_clk_get_enabled in mtk_thermal_probe
  thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe
  thermal/drivers/mediatek: Add temperature constraints to validate read
  Revert "thermal/drivers/mediatek: Add delay after thermal banks initialization"
  thermal/drivers/cpuidle_cooling: Delete unmatched comments
  dt-bindings: thermal: Use generic ADC node name in examples
  dt-bindings: imx-thermal: Add imx6sll and imx6ul compatible

1  2 
drivers/acpi/thermal.c
drivers/thermal/cpuidle_cooling.c

diff --combined drivers/acpi/thermal.c
index ec002ecfe4cf4fb7f02bc211415eaa3b21b26ce7,38bc81b88ea0e3f8f82566450da9894342399080..4720a3649a61bcc8e61cca40f0444a52ba95567b
@@@ -419,9 -419,10 +419,9 @@@ static int acpi_thermal_trips_update(st
                                         * the next higher trip point
                                         */
                                        tz->trips.active[i-1].temperature =
 -                                              (tz->trips.active[i-2].temperature <
 -                                              celsius_to_deci_kelvin(act) ?
 -                                              tz->trips.active[i-2].temperature :
 -                                              celsius_to_deci_kelvin(act));
 +                                              min_t(unsigned long,
 +                                                    tz->trips.active[i-2].temperature,
 +                                                    celsius_to_deci_kelvin(act));
  
                                break;
                        } else {
@@@ -786,6 -787,32 +786,32 @@@ static struct thermal_zone_device_ops a
        .critical = acpi_thermal_zone_device_critical,
  };
  
+ static int acpi_thermal_zone_sysfs_add(struct acpi_thermal *tz)
+ {
+       struct device *tzdev = thermal_zone_device(tz->thermal_zone);
+       int ret;
+       ret = sysfs_create_link(&tz->device->dev.kobj,
+                               &tzdev->kobj, "thermal_zone");
+       if (ret)
+               return ret;
+       ret = sysfs_create_link(&tzdev->kobj,
+                                  &tz->device->dev.kobj, "device");
+       if (ret)
+               sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
+       return ret;
+ }
+ static void acpi_thermal_zone_sysfs_remove(struct acpi_thermal *tz)
+ {
+       struct device *tzdev = thermal_zone_device(tz->thermal_zone);
+       sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
+       sysfs_remove_link(&tzdev->kobj, "device");
+ }
  static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
  {
        int trips = 0;
        if (IS_ERR(tz->thermal_zone))
                return -ENODEV;
  
-       result = sysfs_create_link(&tz->device->dev.kobj,
-                                  &tz->thermal_zone->device.kobj, "thermal_zone");
+       result = acpi_thermal_zone_sysfs_add(tz);
        if (result)
                goto unregister_tzd;
  
-       result = sysfs_create_link(&tz->thermal_zone->device.kobj,
-                                  &tz->device->dev.kobj, "device");
-       if (result)
-               goto remove_tz_link;
        status =  acpi_bus_attach_private_data(tz->device->handle,
                                               tz->thermal_zone);
        if (ACPI_FAILURE(status)) {
                result = -ENODEV;
-               goto remove_dev_link;
+               goto remove_links;
        }
  
        result = thermal_zone_device_enable(tz->thermal_zone);
  
  acpi_bus_detach:
        acpi_bus_detach_private_data(tz->device->handle);
- remove_dev_link:
-       sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
- remove_tz_link:
-       sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
+ remove_links:
+       acpi_thermal_zone_sysfs_remove(tz);
  unregister_tzd:
        thermal_zone_device_unregister(tz->thermal_zone);
  
  
  static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
  {
-       sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
-       sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
+       acpi_thermal_zone_sysfs_remove(tz);
        thermal_zone_device_unregister(tz->thermal_zone);
        tz->thermal_zone = NULL;
        acpi_bus_detach_private_data(tz->device->handle);
index 6f6daead485eee2bbe7fabb3123c2a6134516ed8,7779739fc8acdfb61aa692b416f901efe8ec331d..69f4c0a8dfcc0e791500392684c1780bb5630d63
@@@ -7,13 -7,12 +7,13 @@@
   */
  #define pr_fmt(fmt) "cpuidle cooling: " fmt
  
 +#include <linux/cpu.h>
  #include <linux/cpu_cooling.h>
  #include <linux/cpuidle.h>
  #include <linux/device.h>
  #include <linux/err.h>
  #include <linux/idle_inject.h>
 -#include <linux/of_device.h>
 +#include <linux/of.h>
  #include <linux/slab.h>
  #include <linux/thermal.h>
  
@@@ -237,9 -236,6 +237,6 @@@ out
   *
   * This function is in charge of creating a cooling device per cpuidle
   * driver and register it to the thermal framework.
-  *
-  * Return: zero on success, or negative value corresponding to the
-  * error detected in the underlying subsystems.
   */
  void cpuidle_cooling_register(struct cpuidle_driver *drv)
  {