2020-04-02 14:30:46

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH V2 1/9] thermal: Move default governor config option to the internal header

The default governor set at compilation time is a thermal internal
business, no need to export to the global thermal header.

Move the config options to the internal header.

Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/thermal/thermal_core.h | 11 +++++++++++
include/linux/thermal.h | 11 -----------
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 37cd4e2bead2..828305508556 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -12,6 +12,17 @@
#include <linux/device.h>
#include <linux/thermal.h>

+/* Default Thermal Governor */
+#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
+#define DEFAULT_THERMAL_GOVERNOR "step_wise"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
+#define DEFAULT_THERMAL_GOVERNOR "fair_share"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
+#define DEFAULT_THERMAL_GOVERNOR "user_space"
+#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
+#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
+#endif
+
/* Initial state of a cooling device during binding */
#define THERMAL_NO_TARGET -1UL

diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 448841ab0dca..71cff87dcb46 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -32,17 +32,6 @@
/* use value, which < 0K, to indicate an invalid/uninitialized temperature */
#define THERMAL_TEMP_INVALID -274000

-/* Default Thermal Governor */
-#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
-#define DEFAULT_THERMAL_GOVERNOR "step_wise"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
-#define DEFAULT_THERMAL_GOVERNOR "fair_share"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
-#define DEFAULT_THERMAL_GOVERNOR "user_space"
-#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
-#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
-#endif
-
struct thermal_zone_device;
struct thermal_cooling_device;
struct thermal_instance;
--
2.17.1


2020-04-02 16:27:59

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH V2 2/9] thermal: Move struct thermal_attr to the private header

The structure belongs to the thermal core internals but it is exported
in the include/linux/thermal.h

For better self-encapsulation and less impact for the compilation if a
change is made on it. Move the structure in the thermal core internal
header file.

Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/thermal/thermal_core.h | 5 +++++
include/linux/thermal.h | 6 +-----
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 828305508556..5d08ad60d9df 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -41,6 +41,11 @@ extern struct thermal_governor *__governor_thermal_table_end[];
__governor < __governor_thermal_table_end; \
__governor++)

+struct thermal_attr {
+ struct device_attribute attr;
+ char name[THERMAL_NAME_LENGTH];
+};
+
/*
* This structure is used to describe the behavior of
* a certain cooling device on a certain trip point
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 71cff87dcb46..5aa80fb2fb61 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -35,6 +35,7 @@
struct thermal_zone_device;
struct thermal_cooling_device;
struct thermal_instance;
+struct thermal_attr;

enum thermal_device_mode {
THERMAL_DEVICE_DISABLED = 0,
@@ -119,11 +120,6 @@ struct thermal_cooling_device {
struct list_head node;
};

-struct thermal_attr {
- struct device_attribute attr;
- char name[THERMAL_NAME_LENGTH];
-};
-
/**
* struct thermal_zone_device - structure for a thermal zone
* @id: unique id number for each thermal zone
--
2.17.1

2020-04-02 16:28:15

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH V2 6/9] thermal: Move get_thermal_instance to the internal header

The function is not used any place other than the thermal
directory. It does not make sense to export its definition in the
global header as there is no use of it.

Move the definition to the internal header and allow better
self-encapsulation.

Take the opportunity to add the parameter names to make checkpatch
happy and remove the pointless stubs.

Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/thermal/thermal_core.h | 5 +++++
include/linux/thermal.h | 6 ------
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 5fb2bd9c7034..c95689586e19 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -74,6 +74,11 @@ struct thermal_trip {

int get_tz_trend(struct thermal_zone_device *tz, int trip);

+struct thermal_instance *
+get_thermal_instance(struct thermal_zone_device *tz,
+ struct thermal_cooling_device *cdev,
+ int trip);
+
/*
* This structure is used to describe the behavior of
* a certain cooling device on a certain trip point
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 8006ba5de855..47e745c5dfca 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -414,8 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
int thermal_zone_get_slope(struct thermal_zone_device *tz);
int thermal_zone_get_offset(struct thermal_zone_device *tz);

-struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
- struct thermal_cooling_device *, int);
void thermal_cdev_update(struct thermal_cooling_device *);
void thermal_notify_framework(struct thermal_zone_device *, int);
#else
@@ -473,10 +471,6 @@ static inline int thermal_zone_get_offset(
struct thermal_zone_device *tz)
{ return -ENODEV; }

-static inline struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
- struct thermal_cooling_device *cdev, int trip)
-{ return ERR_PTR(-ENODEV); }
static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
{ }
static inline void thermal_notify_framework(struct thermal_zone_device *tz,
--
2.17.1

2020-04-02 16:28:15

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH V2 7/9] thermal: Change IS_ENABLED to IFDEF in the header file

The thermal framework can not be compiled as a module. The IS_ENABLED
macro is useless here and can be replaced by an ifdef.

Signed-off-by: Daniel Lezcano <[email protected]>
---
include/linux/thermal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 47e745c5dfca..12df9ff0182d 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -383,7 +383,7 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,

#endif

-#if IS_ENABLED(CONFIG_THERMAL)
+#ifdef CONFIG_THERMAL
struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
void *, struct thermal_zone_device_ops *,
struct thermal_zone_params *, int, int);
--
2.17.1

2020-04-04 07:31:54

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH V2 7/9] thermal: Change IS_ENABLED to IFDEF in the header file

On Thu, Apr 2, 2020 at 7:58 PM Daniel Lezcano <[email protected]> wrote:
>
> The thermal framework can not be compiled as a module. The IS_ENABLED
> macro is useless here and can be replaced by an ifdef.
>
> Signed-off-by: Daniel Lezcano <[email protected]>

Reviewed-by: Amit Kucheria <[email protected]>

> ---
> include/linux/thermal.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 47e745c5dfca..12df9ff0182d 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -383,7 +383,7 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev,
>
> #endif
>
> -#if IS_ENABLED(CONFIG_THERMAL)
> +#ifdef CONFIG_THERMAL
> struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
> void *, struct thermal_zone_device_ops *,
> struct thermal_zone_params *, int, int);
> --
> 2.17.1
>

2020-04-04 07:32:25

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH V2 1/9] thermal: Move default governor config option to the internal header

On Thu, Apr 2, 2020 at 7:58 PM Daniel Lezcano <[email protected]> wrote:
>
> The default governor set at compilation time is a thermal internal
> business, no need to export to the global thermal header.
>
> Move the config options to the internal header.
>
> Signed-off-by: Daniel Lezcano <[email protected]>

Reviewed-by: Amit Kucheria <[email protected]>

> ---
> drivers/thermal/thermal_core.h | 11 +++++++++++
> include/linux/thermal.h | 11 -----------
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
> index 37cd4e2bead2..828305508556 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -12,6 +12,17 @@
> #include <linux/device.h>
> #include <linux/thermal.h>
>
> +/* Default Thermal Governor */
> +#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
> +#define DEFAULT_THERMAL_GOVERNOR "step_wise"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
> +#define DEFAULT_THERMAL_GOVERNOR "fair_share"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
> +#define DEFAULT_THERMAL_GOVERNOR "user_space"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
> +#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
> +#endif
> +
> /* Initial state of a cooling device during binding */
> #define THERMAL_NO_TARGET -1UL
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 448841ab0dca..71cff87dcb46 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -32,17 +32,6 @@
> /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
> #define THERMAL_TEMP_INVALID -274000
>
> -/* Default Thermal Governor */
> -#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
> -#define DEFAULT_THERMAL_GOVERNOR "step_wise"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
> -#define DEFAULT_THERMAL_GOVERNOR "fair_share"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
> -#define DEFAULT_THERMAL_GOVERNOR "user_space"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
> -#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
> -#endif
> -
> struct thermal_zone_device;
> struct thermal_cooling_device;
> struct thermal_instance;
> --
> 2.17.1
>

2020-04-04 07:32:48

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH V2 2/9] thermal: Move struct thermal_attr to the private header

On Thu, Apr 2, 2020 at 7:58 PM Daniel Lezcano <[email protected]> wrote:
>
> The structure belongs to the thermal core internals but it is exported
> in the include/linux/thermal.h
>
> For better self-encapsulation and less impact for the compilation if a
> change is made on it. Move the structure in the thermal core internal
> header file.
>
> Signed-off-by: Daniel Lezcano <[email protected]>

Reviewed-by: Amit Kucheria <[email protected]>

> ---
> drivers/thermal/thermal_core.h | 5 +++++
> include/linux/thermal.h | 6 +-----
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
> index 828305508556..5d08ad60d9df 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -41,6 +41,11 @@ extern struct thermal_governor *__governor_thermal_table_end[];
> __governor < __governor_thermal_table_end; \
> __governor++)
>
> +struct thermal_attr {
> + struct device_attribute attr;
> + char name[THERMAL_NAME_LENGTH];
> +};
> +
> /*
> * This structure is used to describe the behavior of
> * a certain cooling device on a certain trip point
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 71cff87dcb46..5aa80fb2fb61 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -35,6 +35,7 @@
> struct thermal_zone_device;
> struct thermal_cooling_device;
> struct thermal_instance;
> +struct thermal_attr;
>
> enum thermal_device_mode {
> THERMAL_DEVICE_DISABLED = 0,
> @@ -119,11 +120,6 @@ struct thermal_cooling_device {
> struct list_head node;
> };
>
> -struct thermal_attr {
> - struct device_attribute attr;
> - char name[THERMAL_NAME_LENGTH];
> -};
> -
> /**
> * struct thermal_zone_device - structure for a thermal zone
> * @id: unique id number for each thermal zone
> --
> 2.17.1
>

2020-04-04 07:34:00

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH V2 6/9] thermal: Move get_thermal_instance to the internal header

On Thu, Apr 2, 2020 at 7:58 PM Daniel Lezcano <[email protected]> wrote:
>
> The function is not used any place other than the thermal
> directory. It does not make sense to export its definition in the
> global header as there is no use of it.
>
> Move the definition to the internal header and allow better
> self-encapsulation.
>
> Take the opportunity to add the parameter names to make checkpatch
> happy and remove the pointless stubs.
>
> Signed-off-by: Daniel Lezcano <[email protected]>

Reviewed-by: Amit Kucheria <[email protected]>

> ---
> drivers/thermal/thermal_core.h | 5 +++++
> include/linux/thermal.h | 6 ------
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
> index 5fb2bd9c7034..c95689586e19 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -74,6 +74,11 @@ struct thermal_trip {
>
> int get_tz_trend(struct thermal_zone_device *tz, int trip);
>
> +struct thermal_instance *
> +get_thermal_instance(struct thermal_zone_device *tz,
> + struct thermal_cooling_device *cdev,
> + int trip);
> +
> /*
> * This structure is used to describe the behavior of
> * a certain cooling device on a certain trip point
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 8006ba5de855..47e745c5dfca 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -414,8 +414,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
> int thermal_zone_get_slope(struct thermal_zone_device *tz);
> int thermal_zone_get_offset(struct thermal_zone_device *tz);
>
> -struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
> - struct thermal_cooling_device *, int);
> void thermal_cdev_update(struct thermal_cooling_device *);
> void thermal_notify_framework(struct thermal_zone_device *, int);
> #else
> @@ -473,10 +471,6 @@ static inline int thermal_zone_get_offset(
> struct thermal_zone_device *tz)
> { return -ENODEV; }
>
> -static inline struct thermal_instance *
> -get_thermal_instance(struct thermal_zone_device *tz,
> - struct thermal_cooling_device *cdev, int trip)
> -{ return ERR_PTR(-ENODEV); }
> static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
> { }
> static inline void thermal_notify_framework(struct thermal_zone_device *tz,
> --
> 2.17.1
>

2020-04-12 08:37:54

by Zhang Rui

[permalink] [raw]
Subject: Re: [PATCH V2 1/9] thermal: Move default governor config option to the internal header

Hi, Daniel,

please feel free to add my Acked-by for the whole patch set.

thanks,
rui

On Thu, 2020-04-02 at 16:27 +0200, Daniel Lezcano wrote:
> The default governor set at compilation time is a thermal internal
> business, no need to export to the global thermal header.
>
> Move the config options to the internal header.
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> drivers/thermal/thermal_core.h | 11 +++++++++++
> include/linux/thermal.h | 11 -----------
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.h
> b/drivers/thermal/thermal_core.h
> index 37cd4e2bead2..828305508556 100644
> --- a/drivers/thermal/thermal_core.h
> +++ b/drivers/thermal/thermal_core.h
> @@ -12,6 +12,17 @@
> #include <linux/device.h>
> #include <linux/thermal.h>
>
> +/* Default Thermal Governor */
> +#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
> +#define DEFAULT_THERMAL_GOVERNOR "step_wise"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
> +#define DEFAULT_THERMAL_GOVERNOR "fair_share"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
> +#define DEFAULT_THERMAL_GOVERNOR "user_space"
> +#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
> +#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
> +#endif
> +
> /* Initial state of a cooling device during binding */
> #define THERMAL_NO_TARGET -1UL
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 448841ab0dca..71cff87dcb46 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -32,17 +32,6 @@
> /* use value, which < 0K, to indicate an invalid/uninitialized
> temperature */
> #define THERMAL_TEMP_INVALID -274000
>
> -/* Default Thermal Governor */
> -#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
> -#define DEFAULT_THERMAL_GOVERNOR "step_wise"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
> -#define DEFAULT_THERMAL_GOVERNOR "fair_share"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
> -#define DEFAULT_THERMAL_GOVERNOR "user_space"
> -#elif defined(CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR)
> -#define DEFAULT_THERMAL_GOVERNOR "power_allocator"
> -#endif
> -
> struct thermal_zone_device;
> struct thermal_cooling_device;
> struct thermal_instance;

2020-04-12 08:42:27

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH V2 1/9] thermal: Move default governor config option to the internal header

On 12/04/2020 10:35, Zhang Rui wrote:
> Hi, Daniel,
>
> please feel free to add my Acked-by for the whole patch set.

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