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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'thermal-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
"These include thermal core fixes and simplifications, driver fixes and
new hardware support (SDM670, Eliza SoC), new driver features (hwmon
support in imx91, DDR data rate on Nova Lake in int340x), and a
handful of cleanups:

- Fix thermal core issues related to thermal zone removal and
registration errors that may lead to a use-after-free or a memory
leak in some cases (Rafael Wysocki)

- Drop a redundant check from thermal_zone_device_update(), adjust
thermal workqueue allocation flags, and switch over thermal_class
allocation to static (Rafael Wysocki)

- Relocate the suspend and resume of thermal zones closer to the
suspend and resume of devices, respectively (Rafael Wysocki)

- Remove a pointless variable used in the thermal core when
registering a cooling device (Daniel Lezcano)

- Replace sprintf() in thermal_bind_cdev_to_trip() and use
str_enabled_disabled() helper in mode_show() (Thorsten Blum)

- Replace cpumask_weight() in intel_hfi_offline() with
cpumask_empty() which is generally more efficient (Yury Norov)

- Add support for reading DDR data rate from PCI config space on Nova
Lake platforms to the int340x thermal driver (Srinivas Pandruvada)

- Add an OF node address to output message to make sensor names more
distinguishable (Alexander Stein)

- Add hwmon support for the i.MX97 thermal sensor (Alexander Stein)

- Clamp correctly the results when doing value/temperature conversion
in the Spreadtrum driver (Thorsten Blum)

- Add SDM670 compatible DT bindings for the Tsens and the lMH thermal
drivers (Richard Acayan)

- Add SM8750 compatible DT bindings for the Tsens thermal driver
(Manaf Meethalavalappu Pallikunhi)

- Add Eliza SoC compatible DT bindings for the Tsens driver
(Krzysztof Kozlowski)

- Fix inverted condition check on error in the Spear thermal control
driver (Gopi Krishna Menon)

- Convert DT bindings documentation into DT schema (Gopi Krishna
Menon)

- Use max() macro to increase readability in the Broadcom STB thermal
sensor (Thorsten Blum)

- Remove a stale @trim_offset kernel-doc entry (John Madieu)"

* tag 'thermal-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (25 commits)
thermal: renesas: rzg3e: Remove stale @trim_offset kernel-doc entry
thermal: core: Suspend thermal zones later and resume them earlier
thermal: core: Allocate thermal_class statically
thermal: core: Adjust thermal_wq allocation flags
thermal: core: Drop redundant check from thermal_zone_device_update()
thermal: core: Free thermal zone ID later during removal
thermal: core: Fix thermal zone governor cleanup issues
thermal/core: Remove pointless variable when registering a cooling device
thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp
dt-bindings: thermal: st,thermal-spear1340: convert to dtschema
thermal/drivers/spear: Fix error condition for reading st,thermal-flags
dt-bindings: thermal: qcom-tsens: Add Eliza SoC TSENS
thermal: devfreq_cooling: avoid unnecessary kfree of freq_table
thermal: intel: hfi: use cpumask_empty() in intel_hfi_offline()
thermal: sysfs: Use str_enabled_disabled() helper in mode_show()
dt-bindings: thermal: qcom-tsens: Document the SM8750 Temperature Sensor
thermal/drivers/sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata
dt-bindings: thermal: lmh: Add SDM670 compatible
dt-bindings: thermal: tsens: add SDM670 compatible
thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp
...

+144 -124
+3
Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
··· 23 23 - qcom,sdm845-lmh 24 24 - qcom,sm8150-lmh 25 25 - items: 26 + - const: qcom,sdm670-lmh 27 + - const: qcom,sdm845-lmh 28 + - items: 26 29 - const: qcom,qcm2290-lmh 27 30 - const: qcom,sm8150-lmh 28 31
+3
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
··· 54 54 - description: v2 of TSENS 55 55 items: 56 56 - enum: 57 + - qcom,eliza-tsens 57 58 - qcom,glymur-tsens 58 59 - qcom,kaanapali-tsens 59 60 - qcom,milos-tsens ··· 72 71 - qcom,sc8180x-tsens 73 72 - qcom,sc8280xp-tsens 74 73 - qcom,sdm630-tsens 74 + - qcom,sdm670-tsens 75 75 - qcom,sdm845-tsens 76 76 - qcom,sm6115-tsens 77 77 - qcom,sm6350-tsens ··· 83 81 - qcom,sm8450-tsens 84 82 - qcom,sm8550-tsens 85 83 - qcom,sm8650-tsens 84 + - qcom,sm8750-tsens 86 85 - qcom,x1e80100-tsens 87 86 - const: qcom,tsens-v2 88 87
-14
Documentation/devicetree/bindings/thermal/spear-thermal.txt
··· 1 - * SPEAr Thermal 2 - 3 - Required properties: 4 - - compatible : "st,thermal-spear1340" 5 - - reg : Address range of the thermal registers 6 - - st,thermal-flags: flags used to enable thermal sensor 7 - 8 - Example: 9 - 10 - thermal@fc000000 { 11 - compatible = "st,thermal-spear1340"; 12 - reg = <0xfc000000 0x1000>; 13 - st,thermal-flags = <0x7000>; 14 - };
+36
Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/thermal/st,thermal-spear1340.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: SPEAr Thermal Sensor 8 + 9 + maintainers: 10 + - Viresh Kumar <vireshk@kernel.org> 11 + 12 + properties: 13 + compatible: 14 + const: st,thermal-spear1340 15 + 16 + reg: 17 + maxItems: 1 18 + 19 + st,thermal-flags: 20 + description: flags used to enable thermal sensor 21 + $ref: /schemas/types.yaml#/definitions/uint32 22 + 23 + required: 24 + - compatible 25 + - reg 26 + - st,thermal-flags 27 + 28 + additionalProperties: false 29 + 30 + examples: 31 + - | 32 + thermal@fc000000 { 33 + compatible = "st,thermal-spear1340"; 34 + reg = <0xfc000000 0x1000>; 35 + st,thermal-flags = <0x7000>; 36 + };
+5
drivers/base/power/main.c
··· 33 33 #include <trace/events/power.h> 34 34 #include <linux/cpufreq.h> 35 35 #include <linux/devfreq.h> 36 + #include <linux/thermal.h> 36 37 #include <linux/timer.h> 37 38 #include <linux/nmi.h> 38 39 ··· 1283 1282 list_splice(&list, &dpm_list); 1284 1283 mutex_unlock(&dpm_list_mtx); 1285 1284 1285 + /* Start resuming thermal control */ 1286 + thermal_pm_complete(); 1286 1287 /* Allow device probing and trigger re-probing of deferred devices */ 1287 1288 device_unblock_probing(); 1288 1289 trace_suspend_resume(TPS("dpm_complete"), state.event, false); ··· 2228 2225 * instead. The normal behavior will be restored in dpm_complete(). 2229 2226 */ 2230 2227 device_block_probing(); 2228 + /* Suspend thermal control. */ 2229 + thermal_pm_prepare(); 2231 2230 2232 2231 mutex_lock(&dpm_list_mtx); 2233 2232 while (!list_empty(&dpm_list) && !error) {
+3 -5
drivers/thermal/broadcom/brcmstb_thermal.c
··· 16 16 #include <linux/irqreturn.h> 17 17 #include <linux/interrupt.h> 18 18 #include <linux/kernel.h> 19 + #include <linux/minmax.h> 19 20 #include <linux/module.h> 20 21 #include <linux/of.h> 21 22 #include <linux/platform_device.h> ··· 155 154 { 156 155 struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); 157 156 u32 val; 158 - long t; 157 + int t; 159 158 160 159 val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); 161 160 ··· 165 164 val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; 166 165 167 166 t = avs_tmon_code_to_temp(priv, val); 168 - if (t < 0) 169 - *temp = 0; 170 - else 171 - *temp = t; 167 + *temp = max(0, t); 172 168 173 169 return 0; 174 170 }
+2 -1
drivers/thermal/devfreq_cooling.c
··· 472 472 remove_qos_req: 473 473 dev_pm_qos_remove_request(&dfc->req_max_freq); 474 474 free_table: 475 - kfree(dfc->freq_table); 475 + if (!dfc->em_pd) 476 + kfree(dfc->freq_table); 476 477 free_dfc: 477 478 kfree(dfc); 478 479
+4
drivers/thermal/imx91_thermal.c
··· 17 17 #include <linux/thermal.h> 18 18 #include <linux/units.h> 19 19 20 + #include "thermal_hwmon.h" 21 + 20 22 #define REG_SET 0x4 21 23 #define REG_CLR 0x8 22 24 #define REG_TOG 0xc ··· 319 317 if (IS_ERR(tmu->tzd)) 320 318 return dev_err_probe(dev, PTR_ERR(tmu->tzd), 321 319 "failed to register thermal zone sensor\n"); 320 + 321 + devm_thermal_add_hwmon_sysfs(dev, tmu->tzd); 322 322 323 323 irq = platform_get_irq(pdev, 0); 324 324 if (irq < 0)
+20 -5
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
··· 402 402 return sysfs_emit(buf, "%llu\n", resp); 403 403 } 404 404 405 + /* ddr_data_rate */ 406 + static const struct mmio_reg nvl_ddr_data_rate_reg = { 1, 0xE0, 10, 0x3FF, 2}; 407 + 408 + static const struct mmio_reg *ddr_data_rate_reg; 409 + 405 410 static ssize_t ddr_data_rate_show(struct device *dev, 406 411 struct device_attribute *attr, 407 412 char *buf) 408 413 { 409 - u16 id = 0x0107; 410 414 u64 resp; 411 - int ret; 412 415 413 - ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); 414 - if (ret) 415 - return ret; 416 + if (ddr_data_rate_reg) { 417 + u16 reg_val; 418 + 419 + pci_read_config_word(to_pci_dev(dev), ddr_data_rate_reg->offset, &reg_val); 420 + resp = (reg_val >> ddr_data_rate_reg->shift) & ddr_data_rate_reg->mask; 421 + resp = (resp * 3333) / 100; 422 + } else { 423 + const u16 id = 0x0107; 424 + int ret; 425 + 426 + ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); 427 + if (ret) 428 + return ret; 429 + } 416 430 417 431 return sysfs_emit(buf, "%llu\n", resp); 418 432 } ··· 475 461 case PCI_DEVICE_ID_INTEL_NVL_H_THERMAL: 476 462 case PCI_DEVICE_ID_INTEL_NVL_S_THERMAL: 477 463 dlvr_mmio_regs_table = nvl_dlvr_mmio_regs; 464 + ddr_data_rate_reg = &nvl_ddr_data_rate_reg; 478 465 break; 479 466 default: 480 467 dlvr_mmio_regs_table = dlvr_mmio_regs;
+1 -1
drivers/thermal/intel/intel_hfi.c
··· 526 526 mutex_lock(&hfi_instance_lock); 527 527 cpumask_clear_cpu(cpu, hfi_instance->cpus); 528 528 529 - if (!cpumask_weight(hfi_instance->cpus)) 529 + if (cpumask_empty(hfi_instance->cpus)) 530 530 hfi_disable(); 531 531 532 532 mutex_unlock(&hfi_instance_lock);
-1
drivers/thermal/renesas/rzg3e_thermal.c
··· 93 93 * @info: chip type specific information 94 94 * @trmval0: calibration value 0 (b) 95 95 * @trmval1: calibration value 1 (c) 96 - * @trim_offset: offset for trim registers in syscon 97 96 * @lock: protects hardware access during conversions 98 97 */ 99 98 struct rzg3e_thermal_priv {
+1 -1
drivers/thermal/spear_thermal.c
··· 93 93 struct device_node *np = pdev->dev.of_node; 94 94 int ret = 0, val; 95 95 96 - if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) { 96 + if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) { 97 97 dev_err(&pdev->dev, "Failed: DT Pdata not passed\n"); 98 98 return -EINVAL; 99 99 }
+3 -3
drivers/thermal/sprd_thermal.c
··· 178 178 static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen, 179 179 u32 rawdata) 180 180 { 181 - clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH); 181 + rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH); 182 182 183 183 /* 184 184 * According to the thermal datasheet, the formula of converting ··· 192 192 { 193 193 u32 val; 194 194 195 - clamp(temp, (int)SPRD_THM_TEMP_LOW, (int)SPRD_THM_TEMP_HIGH); 195 + temp = clamp(temp, SPRD_THM_TEMP_LOW, SPRD_THM_TEMP_HIGH); 196 196 197 197 /* 198 198 * According to the thermal datasheet, the formula of converting ··· 201 201 */ 202 202 val = (temp + sen->cal_offset) / sen->cal_slope; 203 203 204 - return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); 204 + return min(val, SPRD_THM_RAW_DATA_HIGH - 1); 205 205 } 206 206 207 207 static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)
+44 -79
drivers/thermal/thermal_core.c
··· 695 695 } 696 696 EXPORT_SYMBOL_GPL(thermal_zone_device_disable); 697 697 698 - static bool thermal_zone_is_present(struct thermal_zone_device *tz) 699 - { 700 - return !list_empty(&tz->node); 701 - } 702 - 703 698 void thermal_zone_device_update(struct thermal_zone_device *tz, 704 699 enum thermal_notify_event event) 705 700 { 706 701 guard(thermal_zone)(tz); 707 702 708 - if (thermal_zone_is_present(tz)) 709 - __thermal_zone_device_update(tz, event); 703 + __thermal_zone_device_update(tz, event); 710 704 } 711 705 EXPORT_SYMBOL_GPL(thermal_zone_device_update); 712 706 ··· 857 863 goto free_mem; 858 864 859 865 dev->id = result; 860 - sprintf(dev->name, "cdev%d", dev->id); 866 + snprintf(dev->name, sizeof(dev->name), "cdev%d", dev->id); 861 867 result = 862 868 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); 863 869 if (result) ··· 958 964 sizeof("thermal_zone") - 1)) { 959 965 tz = to_thermal_zone(dev); 960 966 thermal_zone_destroy_device_groups(tz); 967 + thermal_set_governor(tz, NULL); 968 + ida_destroy(&tz->ida); 961 969 mutex_destroy(&tz->lock); 962 970 complete(&tz->removal); 963 971 } else if (!strncmp(dev_name(dev), "cooling_device", ··· 972 976 } 973 977 } 974 978 975 - static struct class *thermal_class; 979 + static const struct class thermal_class = { 980 + .name = "thermal", 981 + .dev_release = thermal_release, 982 + }; 983 + static bool thermal_class_unavailable __ro_after_init = true; 976 984 977 985 static inline 978 986 void print_bind_err_msg(struct thermal_zone_device *tz, ··· 1063 1063 { 1064 1064 struct thermal_cooling_device *cdev; 1065 1065 unsigned long current_state; 1066 - int id, ret; 1066 + int ret; 1067 1067 1068 1068 if (!ops || !ops->get_max_state || !ops->get_cur_state || 1069 1069 !ops->set_cur_state) 1070 1070 return ERR_PTR(-EINVAL); 1071 1071 1072 - if (!thermal_class) 1072 + if (thermal_class_unavailable) 1073 1073 return ERR_PTR(-ENODEV); 1074 1074 1075 1075 cdev = kzalloc_obj(*cdev); ··· 1080 1080 if (ret < 0) 1081 1081 goto out_kfree_cdev; 1082 1082 cdev->id = ret; 1083 - id = ret; 1084 1083 1085 1084 cdev->type = kstrdup_const(type ? type : "", GFP_KERNEL); 1086 1085 if (!cdev->type) { ··· 1092 1093 cdev->np = np; 1093 1094 cdev->ops = ops; 1094 1095 cdev->updated = false; 1095 - cdev->device.class = thermal_class; 1096 + cdev->device.class = &thermal_class; 1096 1097 cdev->devdata = devdata; 1097 1098 1098 1099 ret = cdev->ops->get_max_state(cdev, &cdev->max_state); ··· 1136 1137 out_cdev_type: 1137 1138 kfree_const(cdev->type); 1138 1139 out_ida_remove: 1139 - ida_free(&thermal_cdev_ida, id); 1140 + ida_free(&thermal_cdev_ida, cdev->id); 1140 1141 out_kfree_cdev: 1141 1142 kfree(cdev); 1142 1143 return ERR_PTR(ret); ··· 1540 1541 if (polling_delay && passive_delay > polling_delay) 1541 1542 return ERR_PTR(-EINVAL); 1542 1543 1543 - if (!thermal_class) 1544 + if (thermal_class_unavailable) 1544 1545 return ERR_PTR(-ENODEV); 1545 1546 1546 1547 tz = kzalloc_flex(*tz, trips, num_trips); ··· 1576 1577 if (!tz->ops.critical) 1577 1578 tz->ops.critical = thermal_zone_device_critical; 1578 1579 1579 - tz->device.class = thermal_class; 1580 + tz->device.class = &thermal_class; 1580 1581 tz->devdata = devdata; 1581 1582 tz->num_trips = num_trips; 1582 1583 for_each_trip_desc(tz, td) { ··· 1610 1611 /* sys I/F */ 1611 1612 /* Add nodes that are always present via .groups */ 1612 1613 result = thermal_zone_create_device_groups(tz); 1613 - if (result) 1614 + if (result) { 1615 + thermal_set_governor(tz, NULL); 1614 1616 goto remove_id; 1617 + } 1615 1618 1616 1619 result = device_register(&tz->device); 1617 1620 if (result) ··· 1726 1725 1727 1726 cancel_delayed_work_sync(&tz->poll_queue); 1728 1727 1729 - thermal_set_governor(tz, NULL); 1730 - 1731 1728 thermal_thresholds_exit(tz); 1732 1729 thermal_remove_hwmon_sysfs(tz); 1733 - ida_free(&thermal_tz_ida, tz->id); 1734 - ida_destroy(&tz->ida); 1735 1730 1736 1731 device_del(&tz->device); 1737 1732 put_device(&tz->device); ··· 1735 1738 thermal_notify_tz_delete(tz); 1736 1739 1737 1740 wait_for_completion(&tz->removal); 1741 + 1742 + ida_free(&thermal_tz_ida, tz->id); 1743 + 1738 1744 kfree(tz->tzp); 1739 1745 kfree(tz); 1740 1746 } ··· 1823 1823 cancel_delayed_work(&tz->poll_queue); 1824 1824 } 1825 1825 1826 - static void thermal_pm_notify_prepare(void) 1826 + static void __thermal_pm_prepare(void) 1827 1827 { 1828 1828 struct thermal_zone_device *tz; 1829 1829 ··· 1833 1833 1834 1834 list_for_each_entry(tz, &thermal_tz_list, node) 1835 1835 thermal_zone_pm_prepare(tz); 1836 + } 1837 + 1838 + void thermal_pm_prepare(void) 1839 + { 1840 + if (thermal_class_unavailable) 1841 + return; 1842 + 1843 + __thermal_pm_prepare(); 1844 + /* 1845 + * Allow any leftover thermal work items already on the worqueue to 1846 + * complete so they don't get in the way later. 1847 + */ 1848 + flush_workqueue(thermal_wq); 1836 1849 } 1837 1850 1838 1851 static void thermal_zone_pm_complete(struct thermal_zone_device *tz) ··· 1864 1851 mod_delayed_work(thermal_wq, &tz->poll_queue, 0); 1865 1852 } 1866 1853 1867 - static void thermal_pm_notify_complete(void) 1854 + void thermal_pm_complete(void) 1868 1855 { 1869 1856 struct thermal_zone_device *tz; 1857 + 1858 + if (thermal_class_unavailable) 1859 + return; 1870 1860 1871 1861 guard(mutex)(&thermal_list_lock); 1872 1862 ··· 1878 1862 list_for_each_entry(tz, &thermal_tz_list, node) 1879 1863 thermal_zone_pm_complete(tz); 1880 1864 } 1881 - 1882 - static int thermal_pm_notify(struct notifier_block *nb, 1883 - unsigned long mode, void *_unused) 1884 - { 1885 - switch (mode) { 1886 - case PM_HIBERNATION_PREPARE: 1887 - case PM_RESTORE_PREPARE: 1888 - case PM_SUSPEND_PREPARE: 1889 - thermal_pm_notify_prepare(); 1890 - /* 1891 - * Allow any leftover thermal work items already on the 1892 - * worqueue to complete so they don't get in the way later. 1893 - */ 1894 - flush_workqueue(thermal_wq); 1895 - break; 1896 - case PM_POST_HIBERNATION: 1897 - case PM_POST_RESTORE: 1898 - case PM_POST_SUSPEND: 1899 - thermal_pm_notify_complete(); 1900 - break; 1901 - default: 1902 - break; 1903 - } 1904 - return 0; 1905 - } 1906 - 1907 - static struct notifier_block thermal_pm_nb = { 1908 - .notifier_call = thermal_pm_notify, 1909 - /* 1910 - * Run at the lowest priority to avoid interference between the thermal 1911 - * zone resume work items spawned by thermal_pm_notify() and the other 1912 - * PM notifiers. 1913 - */ 1914 - .priority = INT_MIN, 1915 - }; 1916 1865 1917 1866 static int __init thermal_init(void) 1918 1867 { ··· 1889 1908 if (result) 1890 1909 goto error; 1891 1910 1892 - thermal_wq = alloc_workqueue("thermal_events", 1893 - WQ_FREEZABLE | WQ_POWER_EFFICIENT | WQ_PERCPU, 0); 1911 + thermal_wq = alloc_workqueue("thermal_events", WQ_POWER_EFFICIENT, 0); 1894 1912 if (!thermal_wq) { 1895 1913 result = -ENOMEM; 1896 1914 goto unregister_netlink; ··· 1899 1919 if (result) 1900 1920 goto destroy_workqueue; 1901 1921 1902 - thermal_class = kzalloc_obj(*thermal_class); 1903 - if (!thermal_class) { 1904 - result = -ENOMEM; 1905 - goto unregister_governors; 1906 - } 1907 - 1908 - thermal_class->name = "thermal"; 1909 - thermal_class->dev_release = thermal_release; 1910 - 1911 - result = class_register(thermal_class); 1912 - if (result) { 1913 - kfree(thermal_class); 1914 - thermal_class = NULL; 1915 - goto unregister_governors; 1916 - } 1917 - 1918 - result = register_pm_notifier(&thermal_pm_nb); 1922 + result = class_register(&thermal_class); 1919 1923 if (result) 1920 - pr_warn("Thermal: Can not register suspend notifier, return %d\n", 1921 - result); 1924 + goto unregister_governors; 1925 + 1926 + thermal_class_unavailable = false; 1922 1927 1923 1928 return 0; 1924 1929
+10 -10
drivers/thermal/thermal_of.c
··· 144 144 count = of_count_phandle_with_args(child, "thermal-sensors", 145 145 "#thermal-sensor-cells"); 146 146 if (count <= 0) { 147 - pr_err("%pOFn: missing thermal sensor\n", child); 147 + pr_err("%pOFP: missing thermal sensor\n", child); 148 148 return ERR_PTR(-EINVAL); 149 149 } 150 150 ··· 156 156 "#thermal-sensor-cells", 157 157 i, &sensor_specs); 158 158 if (ret < 0) { 159 - pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret); 159 + pr_err("%pOFP: Failed to read thermal-sensors cells: %d\n", child, ret); 160 160 return ERR_PTR(ret); 161 161 } 162 162 163 163 of_node_put(sensor_specs.np); 164 164 if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? 165 165 sensor_specs.args[0] : 0)) { 166 - pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); 166 + pr_debug("sensor %pOFP id=%d belongs to %pOFP\n", sensor, id, child); 167 167 return no_free_ptr(child); 168 168 } 169 169 } ··· 180 180 if (ret == -EINVAL) { 181 181 *pdelay = 0; 182 182 } else if (ret < 0) { 183 - pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret); 183 + pr_err("%pOFP: Couldn't get polling-delay-passive: %d\n", np, ret); 184 184 return ret; 185 185 } 186 186 ··· 188 188 if (ret == -EINVAL) { 189 189 *delay = 0; 190 190 } else if (ret < 0) { 191 - pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret); 191 + pr_err("%pOFP: Couldn't get polling-delay: %d\n", np, ret); 192 192 return ret; 193 193 } 194 194 ··· 380 380 np = of_thermal_zone_find(sensor, id); 381 381 if (IS_ERR(np)) { 382 382 if (PTR_ERR(np) != -ENODEV) 383 - pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id); 383 + pr_err("Failed to find thermal zone for %pOFP id=%d\n", sensor, id); 384 384 return ERR_CAST(np); 385 385 } 386 386 387 387 trips = thermal_of_trips_init(np, &ntrips); 388 388 if (IS_ERR(trips)) { 389 - pr_err("Failed to parse trip points for %pOFn id=%d\n", sensor, id); 389 + pr_err("Failed to parse trip points for %pOFP id=%d\n", sensor, id); 390 390 ret = PTR_ERR(trips); 391 391 goto out_of_node_put; 392 392 } 393 393 394 394 if (!trips) 395 - pr_info("No trip points found for %pOFn id=%d\n", sensor, id); 395 + pr_info("No trip points found for %pOFP id=%d\n", sensor, id); 396 396 397 397 ret = thermal_of_monitor_init(np, &delay, &pdelay); 398 398 if (ret) { 399 - pr_err("Failed to initialize monitoring delays from %pOFn\n", np); 399 + pr_err("Failed to initialize monitoring delays from %pOFP\n", np); 400 400 goto out_kfree_trips; 401 401 } 402 402 ··· 417 417 pdelay, delay); 418 418 if (IS_ERR(tz)) { 419 419 ret = PTR_ERR(tz); 420 - pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); 420 + pr_err("Failed to register thermal zone %pOFP: %d\n", np, ret); 421 421 goto out_kfree_trips; 422 422 } 423 423
+3 -4
drivers/thermal/thermal_sysfs.c
··· 18 18 #include <linux/err.h> 19 19 #include <linux/slab.h> 20 20 #include <linux/string.h> 21 + #include <linux/string_choices.h> 21 22 #include <linux/jiffies.h> 22 23 23 24 #include "thermal_core.h" ··· 57 56 58 57 guard(thermal_zone)(tz); 59 58 60 - if (tz->mode == THERMAL_DEVICE_ENABLED) 61 - return sysfs_emit(buf, "enabled\n"); 62 - 63 - return sysfs_emit(buf, "disabled\n"); 59 + return sysfs_emit(buf, "%s\n", 60 + str_enabled_disabled(tz->mode == THERMAL_DEVICE_ENABLED)); 64 61 } 65 62 66 63 static ssize_t
+6
include/linux/thermal.h
··· 273 273 int thermal_zone_device_enable(struct thermal_zone_device *tz); 274 274 int thermal_zone_device_disable(struct thermal_zone_device *tz); 275 275 void thermal_zone_device_critical(struct thermal_zone_device *tz); 276 + 277 + void thermal_pm_prepare(void); 278 + void thermal_pm_complete(void); 276 279 #else 277 280 static inline struct thermal_zone_device *thermal_zone_device_register_with_trips( 278 281 const char *type, ··· 353 350 354 351 static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) 355 352 { return -ENODEV; } 353 + 354 + static inline void thermal_pm_prepare(void) {} 355 + static inline void thermal_pm_complete(void) {} 356 356 #endif /* CONFIG_THERMAL */ 357 357 358 358 #endif /* __THERMAL_H__ */