From patchwork Sat Oct 12 06:52:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [01/11] thermal: Move default governor config option to the internal header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176043 Message-Id: <20191012065255.23249-1-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:45 +0200 From: Daniel Lezcano List-Id: 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 --- drivers/thermal/thermal_core.h | 11 +++++++++++ include/linux/thermal.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 207b0cda70da..f1206d67047f 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -12,6 +12,17 @@ #include #include +/* 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 e45659c75920..a389d4621814 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -43,17 +43,6 @@ #define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off)) #define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732) -/* 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; From patchwork Sat Oct 12 06:52:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [02/11] thermal: Move struct thermal_attr to the private header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176044 Message-Id: <20191012065255.23249-2-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:46 +0200 From: Daniel Lezcano List-Id: 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 --- drivers/thermal/thermal_core.h | 5 +++++ include/linux/thermal.h | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index f1206d67047f..0e964240524d 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 a389d4621814..603766a4068c 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -46,6 +46,7 @@ struct thermal_zone_device; struct thermal_cooling_device; struct thermal_instance; +struct thermal_attr; enum thermal_device_mode { THERMAL_DEVICE_DISABLED = 0, @@ -130,11 +131,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 From patchwork Sat Oct 12 06:52:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [03/11] thermal: Move internal IPA functions X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176045 Message-Id: <20191012065255.23249-3-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:47 +0200 From: Daniel Lezcano List-Id: The exported IPA functions are used by the IPA. It is pointless to declare the functions in the thermal.h file. For better self-encapsulation and less impact for the compilation if a change is made on it. Move the code in the thermal core internal header file. As the users depends on THERMAL then it is pointless to have the stub, remove them. Take also the opportunity to fix checkpatch warnings/errors when moving the code around. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 13 +++++++++++++ include/linux/thermal.h | 24 ------------------------ 2 files changed, 13 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 0e964240524d..5953bb527ec2 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -46,6 +46,19 @@ struct thermal_attr { char name[THERMAL_NAME_LENGTH]; }; +static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) +{ + return cdev->ops->get_requested_power && cdev->ops->state2power && + cdev->ops->power2state; +} + +int power_actor_get_max_power(struct thermal_cooling_device *cdev, + struct thermal_zone_device *tz, u32 *max_power); +int power_actor_get_min_power(struct thermal_cooling_device *cdev, + struct thermal_zone_device *tz, u32 *min_power); +int power_actor_set_power(struct thermal_cooling_device *cdev, + struct thermal_instance *ti, u32 power); + /* * 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 603766a4068c..fae9ff2b079a 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -400,18 +400,6 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev, #endif #if IS_ENABLED(CONFIG_THERMAL) -static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) -{ - return cdev->ops->get_requested_power && cdev->ops->state2power && - cdev->ops->power2state; -} - -int power_actor_get_max_power(struct thermal_cooling_device *, - struct thermal_zone_device *tz, u32 *max_power); -int power_actor_get_min_power(struct thermal_cooling_device *, - struct thermal_zone_device *tz, u32 *min_power); -int power_actor_set_power(struct thermal_cooling_device *, - struct thermal_instance *, u32); struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, void *, struct thermal_zone_device_ops *, struct thermal_zone_params *, int, int); @@ -449,18 +437,6 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, void thermal_cdev_update(struct thermal_cooling_device *); void thermal_notify_framework(struct thermal_zone_device *, int); #else -static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) -{ return false; } -static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev, - struct thermal_zone_device *tz, u32 *max_power) -{ return 0; } -static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev, - struct thermal_zone_device *tz, - u32 *min_power) -{ return -ENODEV; } -static inline int power_actor_set_power(struct thermal_cooling_device *cdev, - struct thermal_instance *tz, u32 power) -{ return 0; } static inline struct thermal_zone_device *thermal_zone_device_register( const char *type, int trips, int mask, void *devdata, struct thermal_zone_device_ops *ops, From patchwork Sat Oct 12 06:52:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04/11] thermal: Move trip point structure definition to private header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176053 Message-Id: <20191012065255.23249-4-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:48 +0200 From: Daniel Lezcano List-Id: The struct thermal_trip is only used by the thermal internals, it is pointless to export the definition in the global header. Move the structure to the thermal_core.h internal header. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 13 +++++++++++++ include/linux/thermal.h | 15 --------------- 2 files changed, 13 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 5953bb527ec2..6f6e0dcba4f2 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -58,6 +58,19 @@ int power_actor_get_min_power(struct thermal_cooling_device *cdev, struct thermal_zone_device *tz, u32 *min_power); int power_actor_set_power(struct thermal_cooling_device *cdev, struct thermal_instance *ti, u32 power); +/** + * struct thermal_trip - representation of a point in temperature domain + * @np: pointer to struct device_node that this trip point was created from + * @temperature: temperature value in miliCelsius + * @hysteresis: relative hysteresis in miliCelsius + * @type: trip point type + */ +struct thermal_trip { + struct device_node *np; + int temperature; + int hysteresis; + enum thermal_trip_type type; +}; /* * This structure is used to describe the behavior of diff --git a/include/linux/thermal.h b/include/linux/thermal.h index fae9ff2b079a..88e1faa3d72c 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -343,21 +343,6 @@ struct thermal_zone_of_device_ops { int (*set_trip_temp)(void *, int, int); }; -/** - * struct thermal_trip - representation of a point in temperature domain - * @np: pointer to struct device_node that this trip point was created from - * @temperature: temperature value in miliCelsius - * @hysteresis: relative hysteresis in miliCelsius - * @type: trip point type - */ - -struct thermal_trip { - struct device_node *np; - int temperature; - int hysteresis; - enum thermal_trip_type type; -}; - /* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device * From patchwork Sat Oct 12 06:52:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [05/11] thermal: Move set_trips function to the internal header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176046 Message-Id: <20191012065255.23249-5-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:49 +0200 From: Daniel Lezcano List-Id: The function is not used in other place 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 its the definition in the internal header and allow better self-encapsulation. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 6f6e0dcba4f2..301f5603def1 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -72,6 +72,8 @@ struct thermal_trip { enum thermal_trip_type type; }; +void thermal_zone_set_trips(struct thermal_zone_device *tz); + /* * 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 88e1faa3d72c..761d77571533 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -398,7 +398,6 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *); void thermal_zone_device_update(struct thermal_zone_device *, enum thermal_notify_event); -void thermal_zone_set_trips(struct thermal_zone_device *); struct thermal_cooling_device *thermal_cooling_device_register(const char *, void *, const struct thermal_cooling_device_ops *); @@ -444,8 +443,6 @@ static inline int thermal_zone_unbind_cooling_device( static inline void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { } -static inline void thermal_zone_set_trips(struct thermal_zone_device *tz) -{ } static inline struct thermal_cooling_device * thermal_cooling_device_register(char *type, void *devdata, const struct thermal_cooling_device_ops *ops) From patchwork Sat Oct 12 06:52:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06/11] thermal: Move get_tz_trend to the internal header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176048 Message-Id: <20191012065255.23249-6-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:50 +0200 From: Daniel Lezcano List-Id: The function is not used in other place 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 its the definition in 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 --- drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 301f5603def1..c03a07164ca7 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -74,6 +74,8 @@ struct thermal_trip { void thermal_zone_set_trips(struct thermal_zone_device *tz); +int get_tz_trend(struct thermal_zone_device *tz, 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 761d77571533..a87f551d114d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -415,7 +415,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); -int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, struct thermal_cooling_device *, int); void thermal_cdev_update(struct thermal_cooling_device *); @@ -474,8 +473,7 @@ static inline int thermal_zone_get_slope( static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) { return -ENODEV; } -static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) -{ return -ENODEV; } + static inline struct thermal_instance * get_thermal_instance(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev, int trip) From patchwork Sat Oct 12 06:52:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07/11] thermal: Move get_thermal_instance to the internal header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176047 Message-Id: <20191012065255.23249-7-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:51 +0200 From: Daniel Lezcano List-Id: The function is not used in other place 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 its the definition in 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 --- drivers/thermal/thermal_core.h | 5 +++++ include/linux/thermal.h | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index c03a07164ca7..c75309d858ce 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -76,6 +76,11 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz); 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 a87f551d114d..4436addc0e83 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -415,8 +415,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 @@ -474,10 +472,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, From patchwork Sat Oct 12 06:52:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08/11] thermal: Change IS_ENABLED to IFDEF in the header file X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176051 Message-Id: <20191012065255.23249-8-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:52 +0200 From: Daniel Lezcano List-Id: 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 --- include/linux/thermal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 4436addc0e83..d77baa523093 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -384,7 +384,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); From patchwork Sat Oct 12 06:52:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [09/11] thermal: Remove stubs for thermal_zone_[un]bind_cooling_device X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176052 Message-Id: <20191012065255.23249-9-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:53 +0200 From: Daniel Lezcano List-Id: All callers of the functions depends on THERMAL, it is pointless to define stubs. Remove them. Signed-off-by: Daniel Lezcano --- include/linux/thermal.h | 10 ---------- 1 file changed, 10 deletions(-) -- 2.17.1 diff --git a/include/linux/thermal.h b/include/linux/thermal.h index d77baa523093..ae72fe771e07 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -427,16 +427,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register( static inline void thermal_zone_device_unregister( struct thermal_zone_device *tz) { } -static inline int thermal_zone_bind_cooling_device( - struct thermal_zone_device *tz, int trip, - struct thermal_cooling_device *cdev, - unsigned long upper, unsigned long lower, - unsigned int weight) -{ return -ENODEV; } -static inline int thermal_zone_unbind_cooling_device( - struct thermal_zone_device *tz, int trip, - struct thermal_cooling_device *cdev) -{ return -ENODEV; } static inline void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { } From patchwork Sat Oct 12 06:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/11] thermal: Remove thermal_zone_device_update() stub X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176049 Message-Id: <20191012065255.23249-10-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:54 +0200 From: Daniel Lezcano List-Id: All users of the function depends on THERMAL, no stub is needed. Remove it. Signed-off-by: Daniel Lezcano --- include/linux/thermal.h | 3 --- 1 file changed, 3 deletions(-) -- 2.17.1 diff --git a/include/linux/thermal.h b/include/linux/thermal.h index ae72fe771e07..8daa179918a1 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -427,9 +427,6 @@ static inline struct thermal_zone_device *thermal_zone_device_register( static inline void thermal_zone_device_unregister( struct thermal_zone_device *tz) { } -static inline void thermal_zone_device_update(struct thermal_zone_device *tz, - enum thermal_notify_event event) -{ } static inline struct thermal_cooling_device * thermal_cooling_device_register(char *type, void *devdata, const struct thermal_cooling_device_ops *ops) From patchwork Sat Oct 12 06:52:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [11/11] thermal: Move thermal governor structure to internal header X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 176050 Message-Id: <20191012065255.23249-11-daniel.lezcano@linaro.org> To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, amit.kucheria@linaro.org Date: Sat, 12 Oct 2019 08:52:55 +0200 From: Daniel Lezcano List-Id: The thermal governor structure is a big structure where no user should change value inside except via helper functions. Move the structure to the internal header thus preventing external code to be tempted by hacking the structure's variables. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 20 ++++++++++++++++++++ include/linux/thermal.h | 21 +-------------------- 2 files changed, 21 insertions(+), 20 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index c75309d858ce..e54150fa4c5b 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -46,6 +46,26 @@ struct thermal_attr { char name[THERMAL_NAME_LENGTH]; }; +/** + * struct thermal_governor - structure that holds thermal governor information + * @name: name of the governor + * @bind_to_tz: callback called when binding to a thermal zone. If it + * returns 0, the governor is bound to the thermal zone, + * otherwise it fails. + * @unbind_from_tz: callback called when a governor is unbound from a + * thermal zone. + * @throttle: callback called for every trip point even if temperature is + * below the trip point temperature + * @governor_list: node in thermal_governor_list (in thermal_core.c) + */ +struct thermal_governor { + char name[THERMAL_NAME_LENGTH]; + int (*bind_to_tz)(struct thermal_zone_device *tz); + void (*unbind_from_tz)(struct thermal_zone_device *tz); + int (*throttle)(struct thermal_zone_device *tz, int trip); + struct list_head governor_list; +}; + static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) { return cdev->ops->get_requested_power && cdev->ops->state2power && diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 8daa179918a1..04264e8a2bce 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -45,6 +45,7 @@ struct thermal_zone_device; struct thermal_cooling_device; +struct thermal_governor; struct thermal_instance; struct thermal_attr; @@ -206,26 +207,6 @@ struct thermal_zone_device { enum thermal_notify_event notify_event; }; -/** - * struct thermal_governor - structure that holds thermal governor information - * @name: name of the governor - * @bind_to_tz: callback called when binding to a thermal zone. If it - * returns 0, the governor is bound to the thermal zone, - * otherwise it fails. - * @unbind_from_tz: callback called when a governor is unbound from a - * thermal zone. - * @throttle: callback called for every trip point even if temperature is - * below the trip point temperature - * @governor_list: node in thermal_governor_list (in thermal_core.c) - */ -struct thermal_governor { - char name[THERMAL_NAME_LENGTH]; - int (*bind_to_tz)(struct thermal_zone_device *tz); - void (*unbind_from_tz)(struct thermal_zone_device *tz); - int (*throttle)(struct thermal_zone_device *tz, int trip); - struct list_head governor_list; -}; - /* Structure that holds binding parameters for a zone */ struct thermal_bind_params { struct thermal_cooling_device *cdev;