2020-05-11 12:27:25

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 00/14] 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%)

--
2.20.1


2020-05-11 12:27:30

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 01/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.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_core.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9a321dc548c8..286920e06277 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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);

--
2.20.1

2020-05-11 12:27:38

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 03/14] thermal/drivers/thermal_helpers: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_helpers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 2ba756af76b7..8ea0a05404f7 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -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>

--
2.20.1

2020-05-11 12:27:46

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 04/14] thermal/drivers/thermal_helpers: Include export.h

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_helpers.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 8ea0a05404f7..e47da80daf3a 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -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>
--
2.20.1

2020-05-11 12:27:59

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 06/14] thermal/drivers/thermal_hwmon: Include export.h

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_hwmon.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index e43ae551592d..8b92e00ff236 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -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>
--
2.20.1

2020-05-11 12:28:13

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 08/14] thermal/drivers/clock_cooling: Include export.h

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/clock_cooling.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/clock_cooling.c b/drivers/thermal/clock_cooling.c
index fd6bc6eefc88..56cb1f46a428 100644
--- a/drivers/thermal/clock_cooling.c
+++ b/drivers/thermal/clock_cooling.c
@@ -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>
--
2.20.1

2020-05-11 12:28:23

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 10/14] thermal/drivers/cpufreq_cooling: Replace module.h with export.h

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/cpufreq_cooling.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index 1b5a63b4763d..9e124020519f 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -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>
--
2.20.1

2020-05-11 12:28:37

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 12/14] thermal/drivers/user_space: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/user_space.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/user_space.c b/drivers/thermal/user_space.c
index 293cffd9c8ad..82a7198bbe71 100644
--- a/drivers/thermal/user_space.c
+++ b/drivers/thermal/user_space.c
@@ -10,8 +10,8 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

-#include <linux/thermal.h>
#include <linux/slab.h>
+#include <linux/thermal.h>

#include "thermal_core.h"

--
2.20.1

2020-05-11 12:28:59

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 14/14] thermal/of: Rename of-thermal.c

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

Signed-off-by: Amit Kucheria <[email protected]>
---
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%)

diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 09ff0e259d46..d7969dd553cb 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/thermal_of.c
similarity index 100%
rename from drivers/thermal/of-thermal.c
rename to drivers/thermal/thermal_of.c
--
2.20.1

2020-05-11 12:29:01

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 05/14] thermal/drivers/thermal_hwmon: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_hwmon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c8d2620f2e42..e43ae551592d 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -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 */
--
2.20.1

2020-05-11 12:29:30

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 02/14] thermal/core: Replace module.h with export.h

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 286920e06277..bed4a7bea7bb 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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>
--
2.20.1

2020-05-11 12:30:02

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 07/14] thermal/drivers/clock_cooling: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/clock_cooling.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/clock_cooling.c b/drivers/thermal/clock_cooling.c
index 7cb3ae4b44ee..fd6bc6eefc88 100644
--- a/drivers/thermal/clock_cooling.c
+++ b/drivers/thermal/clock_cooling.c
@@ -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
--
2.20.1

2020-05-11 12:30:34

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 11/14] thermal/drivers/of-thermal: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/of-thermal.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 874a47d6923f..ddf88dbe7ba2 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -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"
--
2.20.1

2020-05-11 12:30:54

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 13/14] thermal/governors: Prefix all source files with gov_

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.

Signed-off-by: Amit Kucheria <[email protected]>
---
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%)

diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 8c8ed7b79915..09ff0e259d46 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/gov_fair_share.c
similarity index 100%
rename from drivers/thermal/fair_share.c
rename to drivers/thermal/gov_fair_share.c
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/gov_power_allocator.c
similarity index 100%
rename from drivers/thermal/power_allocator.c
rename to drivers/thermal/gov_power_allocator.c
diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/gov_step_wise.c
similarity index 100%
rename from drivers/thermal/step_wise.c
rename to drivers/thermal/gov_step_wise.c
diff --git a/drivers/thermal/user_space.c b/drivers/thermal/gov_user_space.c
similarity index 100%
rename from drivers/thermal/user_space.c
rename to drivers/thermal/gov_user_space.c
--
2.20.1

2020-05-11 12:31:17

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH 09/14] thermal/drivers/cpufreq_cooling: Sort headers alphabetically

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

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/cpufreq_cooling.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index e297e135c031..1b5a63b4763d 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -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>

--
2.20.1

2020-05-12 04:23:21

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH 00/14] thermal core include cleanups

On 11-05-20, 17:54, Amit Kucheria wrote:
> 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.

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2020-05-22 16:53:27

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH 00/14] thermal core include cleanups

On 11/05/2020 14:24, Amit Kucheria wrote:
> 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 !

--
<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