Skip to contentSkip to conversation

thermal core include cleanups

PATCH In review Amit Kucheria 3 participants 17 messages May 11, 2020 – May 22, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover thermal core include cleanups

I noticed some remnants from when thermal core could be modular. While cleaning that up, I fixed up the includes to be sorted alphabetically and included export.h in files that were using EXPORT_SYMBOL* or THIS_MODULE while at the same time removing inclusion of module.h from core files.

Finally, the names of the source files for the governors and core have some inconsistencies and the last couple of patches rename them.

Build and boot tested on some ARM boards.

Amit Kucheria (14):
thermal/core: Get rid of MODULE_* tags
thermal/core: Replace module.h with export.h thermal/drivers/thermal_helpers: Sort headers alphabetically thermal/drivers/thermal_helpers: Include export.h thermal/drivers/thermal_hwmon: Sort headers alphabetically thermal/drivers/thermal_hwmon: Include export.h thermal/drivers/clock_cooling: Sort headers alphabetically thermal/drivers/clock_cooling: Include export.h thermal/drivers/cpufreq_cooling: Sort headers alphabetically thermal/drivers/cpufreq_cooling: Replace module.h with export.h thermal/drivers/of-thermal: Sort headers alphabetically thermal/drivers/user_space: Sort headers alphabetically thermal/governors: Prefix all source files with gov_ thermal/of: Rename of-thermal.c

 drivers/thermal/Makefile                               | 10 +++++-----
 drivers/thermal/clock_cooling.c                        |  3 ++-
 drivers/thermal/cpufreq_cooling.c                      | 10 +++++-----
 drivers/thermal/{fair_share.c => gov_fair_share.c}     |  0
 .../{power_allocator.c => gov_power_allocator.c}       |  0
 drivers/thermal/{step_wise.c => gov_step_wise.c}       |  0
 drivers/thermal/{user_space.c => gov_user_space.c}     |  2 +-
 drivers/thermal/thermal_core.c                         |  6 +-----
 drivers/thermal/thermal_helpers.c                      |  3 ++-
 drivers/thermal/thermal_hwmon.c                        |  6 ++++--
 drivers/thermal/{of-thermal.c => thermal_of.c}         | 10 +++++-----
 11 files changed, 25 insertions(+), 25 deletions(-)
 rename drivers/thermal/{fair_share.c => gov_fair_share.c} (100%)
 rename drivers/thermal/{power_allocator.c => gov_power_allocator.c} (100%)
 rename drivers/thermal/{step_wise.c => gov_step_wise.c} (100%)
 rename drivers/thermal/{user_space.c => gov_user_space.c} (100%)
 rename drivers/thermal/{of-thermal.c => thermal_of.c} (100%)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/14 thermal/core: Get rid of MODULE_* tags

The thermal framework can no longer be compiled as a module as of commit 554b3529fe01 ("thermal/drivers/core: Remove the module Kconfig's option"). Remove the MODULE_* tags.

Rui is mentioned in the copyright line at the top of the file and the license is mentioned in the SPDX tags. So no loss of information.

---
 drivers/thermal/thermal_core.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/thermal/thermal_core.c +0 -4
index 9a321dc548c8..286920e06277 100644
@@ -27,10 +27,6 @@
 #include "thermal_core.h"
 #include "thermal_hwmon.h"
 
-MODULE_AUTHOR("Zhang Rui");
-MODULE_DESCRIPTION("Generic thermal management sysfs support");
-MODULE_LICENSE("GPL v2");
-
 static DEFINE_IDA(thermal_tz_ida);
 static DEFINE_IDA(thermal_cdev_ida);
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/14 thermal/core: Replace module.h with export.h

In reply to Amit Kucheria

Thermal core cannot be modular, remove the unnecessary module.h include and replace with export.h to handle EXPORT_SYMBOL family of macros.

---
 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.c +1 -1
index 286920e06277..bed4a7bea7bb 100644
@@ -9,9 +9,9 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/kdev_t.h>
 #include <linux/idr.h>
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/14 thermal/drivers/thermal_helpers: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/thermal_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_helpers.c +1 -1
index 2ba756af76b7..8ea0a05404f7 100644
@@ -12,11 +12,11 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/sysfs.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/sysfs.h>
 
 #include <trace/events/thermal.h>
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/14 thermal/drivers/thermal_helpers: Include export.h

In reply to Amit Kucheria

It is preferable to include export.h when you are using EXPORT_SYMBOL family of macros.

---
 drivers/thermal/thermal_helpers.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/thermal_helpers.c +1 -0
index 8ea0a05404f7..e47da80daf3a 100644
@@ -14,6 +14,7 @@
 
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/sysfs.h>
Signature · 1 line
2.20.1
#5 lore raw

PATCH 5/14 thermal/drivers/thermal_hwmon: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/thermal_hwmon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/thermal/thermal_hwmon.c +3 -2
index c8d2620f2e42..e43ae551592d 100644
@@ -10,10 +10,11 @@
  *  Copyright (C) 2013 Texas Instruments
  *  Copyright (C) 2013 Eduardo Valentin <[email protected]>
  */
+#include <linux/err.h>
 #include <linux/hwmon.h>
-#include <linux/thermal.h>
 #include <linux/slab.h>
-#include <linux/err.h>
+#include <linux/thermal.h>
+
 #include "thermal_hwmon.h"
 
 /* hwmon sys I/F */
Signature · 1 line
2.20.1
#6 lore raw

PATCH 6/14 thermal/drivers/thermal_hwmon: Include export.h

In reply to Amit Kucheria

It is preferable to include export.h when you are using EXPORT_SYMBOL family of macros.

---
 drivers/thermal/thermal_hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/thermal_hwmon.c +1 -0
index e43ae551592d..8b92e00ff236 100644
@@ -11,6 +11,7 @@
  *  Copyright (C) 2013 Eduardo Valentin <[email protected]>
  */
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/hwmon.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
Signature · 1 line
2.20.1
#7 lore raw

PATCH 7/14 thermal/drivers/clock_cooling: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/clock_cooling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/clock_cooling.c +1 -1
index 7cb3ae4b44ee..fd6bc6eefc88 100644
@@ -12,6 +12,7 @@
  *  Copyright (C) 2012  Amit Daniel <[email protected]>
  */
 #include <linux/clk.h>
+#include <linux/clock_cooling.h>
 #include <linux/cpufreq.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -20,7 +21,6 @@
 #include <linux/pm_opp.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
-#include <linux/clock_cooling.h>
 
 /**
  * struct clock_cooling_device - data for cooling device with clock
Signature · 1 line
2.20.1
#8 lore raw

PATCH 8/14 thermal/drivers/clock_cooling: Include export.h

In reply to Amit Kucheria

It is preferrable to include export.h when you are using EXPORT_SYMBOL family of macros.

---
 drivers/thermal/clock_cooling.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thermal/clock_cooling.c +1 -0
index fd6bc6eefc88..56cb1f46a428 100644
@@ -16,6 +16,7 @@
 #include <linux/cpufreq.h>
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/idr.h>
 #include <linux/mutex.h>
 #include <linux/pm_opp.h>
Signature · 1 line
2.20.1
#10 lore raw

PATCH 10/14 thermal/drivers/cpufreq_cooling: Replace module.h with export.h

In reply to Amit Kucheria

cpufreq_cooling cannot be modular, remove the unnecessary module.h include and replace with export.h to handle EXPORT_SYMBOL family of macros.

---
 drivers/thermal/cpufreq_cooling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/cpufreq_cooling.c +1 -1
index 1b5a63b4763d..9e124020519f 100644
@@ -10,12 +10,12 @@
  *		Viresh Kumar <[email protected]>
  *
  */
-#include <linux/module.h>
 #include <linux/cpu.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu_cooling.h>
 #include <linux/energy_model.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/idr.h>
 #include <linux/pm_opp.h>
 #include <linux/pm_qos.h>
Signature · 1 line
2.20.1
#9 lore raw

PATCH 9/14 thermal/drivers/cpufreq_cooling: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/cpufreq_cooling.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/cpufreq_cooling.c +4 -4
index e297e135c031..1b5a63b4763d 100644
@@ -11,16 +11,16 @@
  *
  */
 #include <linux/module.h>
-#include <linux/thermal.h>
+#include <linux/cpu.h>
 #include <linux/cpufreq.h>
+#include <linux/cpu_cooling.h>
+#include <linux/energy_model.h>
 #include <linux/err.h>
 #include <linux/idr.h>
 #include <linux/pm_opp.h>
 #include <linux/pm_qos.h>
 #include <linux/slab.h>
-#include <linux/cpu.h>
-#include <linux/cpu_cooling.h>
-#include <linux/energy_model.h>
+#include <linux/thermal.h>
 
 #include <trace/events/thermal.h>
 
Signature · 1 line
2.20.1
#11 lore raw

PATCH 11/14 thermal/drivers/of-thermal: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/of-thermal.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/thermal/of-thermal.c +5 -5
index 874a47d6923f..ddf88dbe7ba2 100644
@@ -8,13 +8,13 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/thermal.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/of_device.h>
-#include <linux/of_platform.h>
 #include <linux/err.h>
 #include <linux/export.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/slab.h>
+#include <linux/thermal.h>
+#include <linux/types.h>
 #include <linux/string.h>
 
 #include "thermal_core.h"
Signature · 1 line
2.20.1
#12 lore raw

PATCH 12/14 thermal/drivers/user_space: Sort headers alphabetically

In reply to Amit Kucheria

Sort headers to make it easier to read and find duplicate headers.

---
 drivers/thermal/user_space.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/user_space.c +1 -1
index 293cffd9c8ad..82a7198bbe71 100644
@@ -10,8 +10,8 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
-#include <linux/thermal.h>
 #include <linux/slab.h>
+#include <linux/thermal.h>
 
 #include "thermal_core.h"
 
Signature · 1 line
2.20.1
#13 lore raw

PATCH 13/14 thermal/governors: Prefix all source files with gov_

In reply to Amit Kucheria

Bang-bang governor source file is prefixed with gov_. Do the same for other governors for consistency so they're easy to find in the sources.

---
 drivers/thermal/Makefile                                  | 8 ++++----
 drivers/thermal/{fair_share.c => gov_fair_share.c}        | 0
 .../thermal/{power_allocator.c => gov_power_allocator.c}  | 0
 drivers/thermal/{step_wise.c => gov_step_wise.c}          | 0
 drivers/thermal/{user_space.c => gov_user_space.c}        | 0
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename drivers/thermal/{fair_share.c => gov_fair_share.c} (100%)
 rename drivers/thermal/{power_allocator.c => gov_power_allocator.c} (100%)
 rename drivers/thermal/{step_wise.c => gov_step_wise.c} (100%)
 rename drivers/thermal/{user_space.c => gov_user_space.c} (100%)
drivers/thermal/Makefile +4 -4
index 8c8ed7b79915..09ff0e259d46 100644
@@ -12,11 +12,11 @@ thermal_sys-$(CONFIG_THERMAL_HWMON)		+= thermal_hwmon.o
 thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
-thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= gov_fair_share.o
 thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
-thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
-thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
-thermal_sys-$(CONFIG_THERMAL_GOV_POWER_ALLOCATOR)	+= power_allocator.o
+thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= gov_step_wise.o
+thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= gov_user_space.o
+thermal_sys-$(CONFIG_THERMAL_GOV_POWER_ALLOCATOR)	+= gov_power_allocator.o
 
 # cpufreq cooling
 thermal_sys-$(CONFIG_CPU_FREQ_THERMAL)	+= cpufreq_cooling.o
drivers/thermal/gov_fair_share.c renamed from drivers/thermal/fair_share.c +0 -0
similarity index 100%
rename from drivers/thermal/fair_share.c
rename to drivers/thermal/gov_fair_share.c
drivers/thermal/gov_power_allocator.c renamed from drivers/thermal/power_allocator.c +0 -0
similarity index 100%
rename from drivers/thermal/power_allocator.c
rename to drivers/thermal/gov_power_allocator.c
drivers/thermal/gov_step_wise.c renamed from drivers/thermal/step_wise.c +0 -0
similarity index 100%
rename from drivers/thermal/step_wise.c
rename to drivers/thermal/gov_step_wise.c
drivers/thermal/gov_user_space.c renamed from drivers/thermal/user_space.c +0 -0
similarity index 100%
rename from drivers/thermal/user_space.c
rename to drivers/thermal/gov_user_space.c
Signature · 1 line
2.20.1
#14 lore raw

PATCH 14/14 thermal/of: Rename of-thermal.c

In reply to Amit Kucheria

Core thermal framework code files should start with thermal_*. of-thermal.c does not follow this pattern and can easily be confused with platform driver.

Fix this by renaming it to thermal_of.c

---
 drivers/thermal/Makefile                       | 2 +-
 drivers/thermal/{of-thermal.c => thermal_of.c} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/thermal/{of-thermal.c => thermal_of.c} (100%)
drivers/thermal/Makefile +1 -1
index 09ff0e259d46..d7969dd553cb 100644
@@ -9,7 +9,7 @@ thermal_sys-y			+= thermal_core.o thermal_sysfs.o \
 
 # interface to/from other layers providing sensors
 thermal_sys-$(CONFIG_THERMAL_HWMON)		+= thermal_hwmon.o
-thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
+thermal_sys-$(CONFIG_THERMAL_OF)		+= thermal_of.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= gov_fair_share.o
drivers/thermal/thermal_of.c renamed from drivers/thermal/of-thermal.c +0 -0
similarity index 100%
rename from drivers/thermal/of-thermal.c
rename to drivers/thermal/thermal_of.c
Signature · 1 line
2.20.1
maintainer Acked-by on the v1 series
#15 lore raw
In reply to Amit Kucheria
Quoted 9 lines · Amit Kucheria

I noticed some remnants from when thermal core could be modular. While cleaning that up, I fixed up the includes to be sorted alphabetically and included export.h in files that were using EXPORT_SYMBOL* or THIS_MODULE while at the same time removing inclusion of module.h from core files.

Finally, the names of the source files for the governors and core have some inconsistencies and the last couple of patches rename them.

Build and boot tested on some ARM boards.

Signature · 1 line
viresh
#16 lore raw
In reply to Amit Kucheria
Quoted 9 lines · Amit Kucheria

I noticed some remnants from when thermal core could be modular. While cleaning that up, I fixed up the includes to be sorted alphabetically and included export.h in files that were using EXPORT_SYMBOL* or THIS_MODULE while at the same time removing inclusion of module.h from core files.

Finally, the names of the source files for the governors and core have some inconsistencies and the last couple of patches rename them.

Build and boot tested on some ARM boards.

Series applied, thanks !

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog