From 6eb61a9361951e466628bcb0abaf0a197181ec97 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Sun, 21 Apr 2019 16:45:11 +0800 Subject: thermal/int3403_thermal: favor _TMP instead of PTYP All the INT3403 devices with _TMP can be a sensor. Link: https://bugzilla.kernel.org/show_bug.cgi?id=202671 Signed-off-by: Zhang Rui --- drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c index 0c19fcd56a0da..79a7df2baa924 100644 --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c @@ -220,6 +220,7 @@ static int int3403_add(struct platform_device *pdev) { struct int3403_priv *priv; int result = 0; + unsigned long long tmp; acpi_status status; priv = devm_kzalloc(&pdev->dev, sizeof(struct int3403_priv), @@ -234,19 +235,18 @@ static int int3403_add(struct platform_device *pdev) goto err; } - status = acpi_evaluate_integer(priv->adev->handle, "PTYP", - NULL, &priv->type); - if (ACPI_FAILURE(status)) { - unsigned long long tmp; - status = acpi_evaluate_integer(priv->adev->handle, "_TMP", - NULL, &tmp); + status = acpi_evaluate_integer(priv->adev->handle, "_TMP", + NULL, &tmp); + if (ACPI_FAILURE(status)) { + status = acpi_evaluate_integer(priv->adev->handle, "PTYP", + NULL, &priv->type); if (ACPI_FAILURE(status)) { result = -EINVAL; goto err; - } else { - priv->type = INT3403_TYPE_SENSOR; } + } else { + priv->type = INT3403_TYPE_SENSOR; } platform_set_drvdata(pdev, priv); -- cgit v1.2.3 From 1948d498dcf680bc650391f23da2f97e59f9126d Mon Sep 17 00:00:00 2001 From: Sumeet Pawnikar Date: Mon, 15 Apr 2019 20:18:30 +0530 Subject: thermal: intel: int340x: processor_thermal_device: simplify to get driver data This simplifies getting the 'driver_data' from 'struct device' directly. Going through platform_device or pci_dev is not required. Also removes condition check as the private data stored with dev pointer, means irrespective of enumeration mode, we can use dev_get_drvdata(). This removes the unnecessary step back and forth. Signed-off-by: Sumeet Pawnikar Reviewed-by: Andy Shevchenko Signed-off-by: Zhang Rui --- .../thermal/intel/int340x_thermal/processor_thermal_device.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c index 8e1cf4d789be1..2a7cbaa1712d3 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c @@ -81,22 +81,13 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \ struct device_attribute *attr, \ char *buf) \ { \ - struct pci_dev *pci_dev; \ - struct platform_device *pdev; \ - struct proc_thermal_device *proc_dev; \ + struct proc_thermal_device *proc_dev = dev_get_drvdata(dev); \ \ if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \ dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \ return 0; \ } \ \ - if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ - pdev = to_platform_device(dev); \ - proc_dev = platform_get_drvdata(pdev); \ - } else { \ - pci_dev = to_pci_dev(dev); \ - proc_dev = pci_get_drvdata(pci_dev); \ - } \ return sprintf(buf, "%lu\n",\ (unsigned long)proc_dev->power_limits[index].suffix * 1000); \ } -- cgit v1.2.3 From 554b3529fe018e74cb5d0d0f476ee793b58b030a Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 2 Apr 2019 18:12:44 +0200 Subject: thermal/drivers/core: Remove the module Kconfig's option The module support for the thermal subsystem makes little sense: - some subsystems relying on it are not modules, thus forcing the framework to be compiled in - it is compiled in for almost every configs, the remaining ones are a few platforms where I don't see why we can not switch the thermal to 'y'. The drivers can stay in tristate. - platforms need the thermal to be ready as soon as possible at boot time in order to mitigate Usually the subsystems framework are compiled-in and the plugs are as module. Remove the module option. The removal of the module related dead code will come after this patch gets in or is acked. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck For mini2440: Acked-by: Krzysztof Kozlowski Acked-by: Paul Burton # MIPS part Acked-by: Robert Jarzmik Signed-off-by: Zhang Rui --- arch/arm/configs/mini2440_defconfig | 2 +- arch/arm/configs/pxa_defconfig | 2 +- arch/mips/configs/ip22_defconfig | 2 +- arch/mips/configs/ip27_defconfig | 2 +- arch/unicore32/configs/unicore32_defconfig | 2 +- drivers/thermal/Kconfig | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/thermal') diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig index d95a8059d30be..0cf1c120c4bb2 100644 --- a/arch/arm/configs/mini2440_defconfig +++ b/arch/arm/configs/mini2440_defconfig @@ -152,7 +152,7 @@ CONFIG_SPI_S3C24XX=y CONFIG_SPI_SPIDEV=y CONFIG_GPIO_SYSFS=y CONFIG_SENSORS_LM75=y -CONFIG_THERMAL=m +CONFIG_THERMAL=y CONFIG_WATCHDOG=y CONFIG_S3C2410_WATCHDOG=y CONFIG_FB=y diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig index d4654755b09cb..d4f9dda3a52f7 100644 --- a/arch/arm/configs/pxa_defconfig +++ b/arch/arm/configs/pxa_defconfig @@ -387,7 +387,7 @@ CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM90=m CONFIG_SENSORS_LM95245=m CONFIG_SENSORS_NTC_THERMISTOR=m -CONFIG_THERMAL=m +CONFIG_THERMAL=y CONFIG_WATCHDOG=y CONFIG_XILINX_WATCHDOG=m CONFIG_SA1100_WATCHDOG=m diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig index ff40fbc2f4399..21a1168ae301f 100644 --- a/arch/mips/configs/ip22_defconfig +++ b/arch/mips/configs/ip22_defconfig @@ -228,7 +228,7 @@ CONFIG_SERIAL_IP22_ZILOG=m # CONFIG_HW_RANDOM is not set CONFIG_RAW_DRIVER=m # CONFIG_HWMON is not set -CONFIG_THERMAL=m +CONFIG_THERMAL=y CONFIG_WATCHDOG=y CONFIG_INDYDOG=m # CONFIG_VGA_CONSOLE is not set diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig index 81c47e18131bd..54db5dedf7764 100644 --- a/arch/mips/configs/ip27_defconfig +++ b/arch/mips/configs/ip27_defconfig @@ -271,7 +271,7 @@ CONFIG_I2C_PARPORT_LIGHT=m CONFIG_I2C_TAOS_EVM=m CONFIG_I2C_STUB=m # CONFIG_HWMON is not set -CONFIG_THERMAL=m +CONFIG_THERMAL=y CONFIG_MFD_PCF50633=m CONFIG_PCF50633_ADC=m CONFIG_PCF50633_GPIO=m diff --git a/arch/unicore32/configs/unicore32_defconfig b/arch/unicore32/configs/unicore32_defconfig index aebd01fc28e59..360cc9abcdb09 100644 --- a/arch/unicore32/configs/unicore32_defconfig +++ b/arch/unicore32/configs/unicore32_defconfig @@ -119,7 +119,7 @@ CONFIG_I2C_PUV3=y # Hardware Monitoring support #CONFIG_SENSORS_LM75=m # Generic Thermal sysfs driver -#CONFIG_THERMAL=m +#CONFIG_THERMAL=y #CONFIG_THERMAL_HWMON=y # Multimedia support diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 653aa27a25a49..ccf5b9408d7a5 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -3,7 +3,7 @@ # menuconfig THERMAL - tristate "Generic Thermal sysfs driver" + bool "Generic Thermal sysfs driver" help Generic Thermal Sysfs driver offers a generic mechanism for thermal management. Usually it's made up of one or more thermal @@ -11,7 +11,7 @@ menuconfig THERMAL Each thermal zone contains its own temperature, trip points, cooling devices. All platforms with ACPI thermal support can use this driver. - If you want this support, you should say Y or M here. + If you want this support, you should say Y here. if THERMAL -- cgit v1.2.3 From 77e1dd46a1ad098f2bdb1fc953fea0d59e5d7fb6 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 2 Apr 2019 18:12:45 +0200 Subject: thermal/drivers/core: Remove module unload code Now the thermal core is no longer compiled as a module. Remove the unloading module code and move the unregister function to the __init section. Signed-off-by: Daniel Lezcano Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6590bb5cb6885..28f7ece0e8fee 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -266,7 +266,7 @@ static int __init thermal_register_governors(void) return thermal_gov_power_allocator_register(); } -static void thermal_unregister_governors(void) +static void __init thermal_unregister_governors(void) { thermal_gov_step_wise_unregister(); thermal_gov_fair_share_unregister(); @@ -1563,19 +1563,4 @@ error: mutex_destroy(&poweroff_lock); return result; } - -static void __exit thermal_exit(void) -{ - unregister_pm_notifier(&thermal_pm_nb); - of_thermal_destroy_zones(); - genetlink_exit(); - class_unregister(&thermal_class); - thermal_unregister_governors(); - ida_destroy(&thermal_tz_ida); - ida_destroy(&thermal_cdev_ida); - mutex_destroy(&thermal_list_lock); - mutex_destroy(&thermal_governor_lock); -} - fs_initcall(thermal_init); -module_exit(thermal_exit); -- cgit v1.2.3 From e9cf125bc1f99caacd1f4700b2c78659c53c4d9d Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 2 Apr 2019 18:12:48 +0200 Subject: thermal/drivers/core: Remove depends on THERMAL in Kconfig The dependency on the THERMAL option to be set is already there implicitly by the "if THERMAL" conditionnal option. The sub Kconfigs do not have to check against the THERMAL option as they are called from a Kconfig block which is enabled by the conditionnal option. Remove the useless "depends on THERMAL" in the Kconfigs. Signed-off-by: Daniel Lezcano Signed-off-by: Zhang Rui --- drivers/thermal/Kconfig | 2 -- drivers/thermal/intel/Kconfig | 1 - drivers/thermal/qcom/Kconfig | 1 - 3 files changed, 4 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index ccf5b9408d7a5..d8aa7fac8c56f 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -24,7 +24,6 @@ config THERMAL_STATISTICS config THERMAL_EMERGENCY_POWEROFF_DELAY_MS int "Emergency poweroff delay in milli-seconds" - depends on THERMAL default 0 help Thermal subsystem will issue a graceful shutdown when @@ -152,7 +151,6 @@ config CPU_THERMAL bool "generic cpu cooling support" depends on CPU_FREQ depends on THERMAL_OF - depends on THERMAL=y help This implements the generic cpu cooling mechanism through frequency reduction. An ACPI version of this already exists diff --git a/drivers/thermal/intel/Kconfig b/drivers/thermal/intel/Kconfig index 2e013eeb4a1d9..2c727a820759c 100644 --- a/drivers/thermal/intel/Kconfig +++ b/drivers/thermal/intel/Kconfig @@ -1,6 +1,5 @@ config INTEL_POWERCLAMP tristate "Intel PowerClamp idle injection driver" - depends on THERMAL depends on X86 depends on CPU_SUP_INTEL help diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig index cdb455ffd5752..3ce20fec86a2b 100644 --- a/drivers/thermal/qcom/Kconfig +++ b/drivers/thermal/qcom/Kconfig @@ -1,6 +1,5 @@ config QCOM_TSENS tristate "Qualcomm TSENS Temperature Alarm" - depends on THERMAL depends on QCOM_QFPROM depends on ARCH_QCOM || COMPILE_TEST help -- cgit v1.2.3 From 2e31c8560a564a70f13e3b6acab49bffbe41e965 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 2 Apr 2019 18:12:49 +0200 Subject: thermal/drivers/core: Fix typo in the option name Unlike the other options, the cpu cooling option is beginning with a lowercase letter, changing to a uppercase. Signed-off-by: Daniel Lezcano Signed-off-by: Zhang Rui --- drivers/thermal/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index d8aa7fac8c56f..83e95a4fb61b2 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -148,7 +148,7 @@ config THERMAL_GOV_POWER_ALLOCATOR allocating and limiting power to devices. config CPU_THERMAL - bool "generic cpu cooling support" + bool "Generic cpu cooling support" depends on CPU_FREQ depends on THERMAL_OF help -- cgit v1.2.3 From 44c0c23725a16c8803b8809b87651405e8741e4d Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Mon, 29 Apr 2019 20:42:13 -0700 Subject: drivers: thermal: processor_thermal: Downgrade error message Downgrade "Unsupported event" message from dev_err to dev_dbg. Otherwise it floods with this message one some platforms. Signed-off-by: Srinivas Pandruvada Signed-off-by: Zhang Rui --- drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c index 2a7cbaa1712d3..2e6071a82da27 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c @@ -265,7 +265,7 @@ static void proc_thermal_notify(acpi_handle handle, u32 event, void *data) THERMAL_DEVICE_POWER_CAPABILITY_CHANGED); break; default: - dev_err(proc_priv->dev, "Unsupported event [0x%x]\n", event); + dev_dbg(proc_priv->dev, "Unsupported event [0x%x]\n", event); break; } } -- cgit v1.2.3