From 57df8106932b57427df1eaaa13871857f75b1194 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Fri, 8 Feb 2013 14:52:06 +0800 Subject: Thermal: exynos: fix cooling state translation Signed-off-by: Zhang Rui Tested-by: Amit Daniel kachhap --- include/linux/cpu_cooling.h | 7 +++++++ include/linux/thermal.h | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index 40b4ef54cc7d..bc479b1e0fd9 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -42,6 +42,8 @@ struct thermal_cooling_device *cpufreq_cooling_register( * @cdev: thermal cooling device pointer. */ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); + +unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); #else /* !CONFIG_CPU_THERMAL */ static inline struct thermal_cooling_device *cpufreq_cooling_register( const struct cpumask *clip_cpus) @@ -53,6 +55,11 @@ static inline void cpufreq_cooling_unregister( { return; } +static inline unsigned long cpufreq_cooling_get_level(unsigned int, + unsigned int) +{ + return THERMAL_CSTATE_INVALID; +} #endif /* CONFIG_CPU_THERMAL */ #endif /* __CPU_COOLING_H__ */ diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f0bd7f90a90d..5a3b428daaab 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -33,8 +33,11 @@ #define THERMAL_MAX_TRIPS 12 #define THERMAL_NAME_LENGTH 20 +/* invalid cooling state */ +#define THERMAL_CSTATE_INVALID -1UL + /* No upper/lower limit requirement */ -#define THERMAL_NO_LIMIT -1UL +#define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID /* Unit conversion macros */ #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ -- cgit v1.2.3-59-g8ed1b From f8b587055a793c7719f0d4f41b7b4aeeef43aa2d Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Wed, 20 Mar 2013 21:38:07 +0000 Subject: thermal: Fix compiler warning The following warning is obtained when CONFIG_NET is not defined: In file included from drivers/thermal/mvebu_thermal.c:27:0: include/linux/thermal.h:254:12: warning: 'thermal_generate_netlink_event' defined but not used [-Wunused-function] This patch fixes the warning by properly inlining thermal_generate_netlink_event(). Signed-off-by: Ezequiel Garcia Signed-off-by: Zhang Rui --- include/linux/thermal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f0bd7f90a90d..fd7b8f3e6f42 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -251,7 +251,7 @@ void thermal_unregister_governor(struct thermal_governor *); extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, enum events event); #else -static int thermal_generate_netlink_event(struct thermal_zone_device *tz, +static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz, enum events event) { return 0; -- cgit v1.2.3-59-g8ed1b From 80a26a5c22b90a82b8696cb72c1d09d525ada53e Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Tue, 26 Mar 2013 16:38:29 +0800 Subject: Thermal: build thermal governors into thermal_sys module The thermal governors are part of the thermal framework, rather than a seperate feature/module. Because the generic thermal layer can not work without thermal governors, and it must load the thermal governors during its initialization. Build them into one module in this patch. This also fix a problem that the generic thermal layer does not work when CONFIG_THERMAL=m and CONFIG_THERMAL_GOV_XXX=y. Signed-off-by: Zhang Rui Acked-by: Eduardo Valentin Acked-by: Durgadoss R --- Documentation/thermal/sysfs-api.txt | 8 ----- drivers/thermal/Makefile | 6 ++-- drivers/thermal/fair_share.c | 15 ++-------- drivers/thermal/step_wise.c | 16 ++-------- drivers/thermal/thermal_core.c | 59 ++++++++++++++++++++++++++++++------- drivers/thermal/thermal_core.h | 27 +++++++++++++++++ drivers/thermal/user_space.c | 15 ++-------- include/linux/thermal.h | 4 --- 8 files changed, 84 insertions(+), 66 deletions(-) (limited to 'include') diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt index 277530a5786c..b2ffe98cf469 100644 --- a/Documentation/thermal/sysfs-api.txt +++ b/Documentation/thermal/sysfs-api.txt @@ -379,11 +379,3 @@ platform data is provided, this uses the step_wise throttling policy. This function serves as an arbitrator to set the state of a cooling device. It sets the cooling device to the deepest cooling state if possible. - -5.5:thermal_register_governor: -This function lets the various thermal governors to register themselves -with the Thermal framework. At run time, depending on a zone's platform -data, a particular governor is used for throttling. - -5.6:thermal_unregister_governor: -This function unregisters a governor from the thermal framework. diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 1bf2eab50b27..b17bfb055498 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -6,9 +6,9 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o thermal_sys-y += thermal_core.o # governors -obj-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += fair_share.o -obj-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o -obj-$(CONFIG_THERMAL_GOV_USER_SPACE) += user_space.o +thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += fair_share.o +thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o +thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE) += user_space.o # cpufreq cooling obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c index 792479f2b64b..944ba2f340c8 100644 --- a/drivers/thermal/fair_share.c +++ b/drivers/thermal/fair_share.c @@ -22,9 +22,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include #include #include "thermal_core.h" @@ -111,23 +108,15 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip) static struct thermal_governor thermal_gov_fair_share = { .name = "fair_share", .throttle = fair_share_throttle, - .owner = THIS_MODULE, }; -static int __init thermal_gov_fair_share_init(void) +int thermal_gov_fair_share_register(void) { return thermal_register_governor(&thermal_gov_fair_share); } -static void __exit thermal_gov_fair_share_exit(void) +void thermal_gov_fair_share_unregister(void) { thermal_unregister_governor(&thermal_gov_fair_share); } -/* This should load after thermal framework */ -fs_initcall(thermal_gov_fair_share_init); -module_exit(thermal_gov_fair_share_exit); - -MODULE_AUTHOR("Durgadoss R"); -MODULE_DESCRIPTION("A simple weight based thermal throttling governor"); -MODULE_LICENSE("GPL"); diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index ca4f79fb72cf..4d4ddae1a991 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -22,9 +22,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include #include #include "thermal_core.h" @@ -186,23 +183,14 @@ static int step_wise_throttle(struct thermal_zone_device *tz, int trip) static struct thermal_governor thermal_gov_step_wise = { .name = "step_wise", .throttle = step_wise_throttle, - .owner = THIS_MODULE, }; -static int __init thermal_gov_step_wise_init(void) +int thermal_gov_step_wise_register(void) { return thermal_register_governor(&thermal_gov_step_wise); } -static void __exit thermal_gov_step_wise_exit(void) +void thermal_gov_step_wise_unregister(void) { thermal_unregister_governor(&thermal_gov_step_wise); } - -/* This should load after thermal framework */ -fs_initcall(thermal_gov_step_wise_init); -module_exit(thermal_gov_step_wise_exit); - -MODULE_AUTHOR("Durgadoss R"); -MODULE_DESCRIPTION("A step-by-step thermal throttling governor"); -MODULE_LICENSE("GPL"); diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5b7863a03f98..4cdc3e327222 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -99,7 +99,6 @@ int thermal_register_governor(struct thermal_governor *governor) return err; } -EXPORT_SYMBOL_GPL(thermal_register_governor); void thermal_unregister_governor(struct thermal_governor *governor) { @@ -127,7 +126,6 @@ exit: mutex_unlock(&thermal_governor_lock); return; } -EXPORT_SYMBOL_GPL(thermal_unregister_governor); static int get_idr(struct idr *idr, struct mutex *lock, int *id) { @@ -1858,30 +1856,69 @@ static inline int genetlink_init(void) { return 0; } static inline void genetlink_exit(void) {} #endif /* !CONFIG_NET */ +static int __init thermal_register_governors(void) +{ + int result; + + result = thermal_gov_step_wise_register(); + if (result) + return result; + + result = thermal_gov_fair_share_register(); + if (result) + return result; + + return thermal_gov_user_space_register(); +} + +static void thermal_unregister_governors(void) +{ + thermal_gov_step_wise_unregister(); + thermal_gov_fair_share_unregister(); + thermal_gov_user_space_unregister(); +} + static int __init thermal_init(void) { - int result = 0; + int result; + + result = thermal_register_governors(); + if (result) + goto error; result = class_register(&thermal_class); - if (result) { - idr_destroy(&thermal_tz_idr); - idr_destroy(&thermal_cdev_idr); - mutex_destroy(&thermal_idr_lock); - mutex_destroy(&thermal_list_lock); - return result; - } + if (result) + goto unregister_governors; + result = genetlink_init(); + if (result) + goto unregister_class; + + return 0; + +unregister_governors: + thermal_unregister_governors(); +unregister_class: + class_unregister(&thermal_class); +error: + idr_destroy(&thermal_tz_idr); + idr_destroy(&thermal_cdev_idr); + mutex_destroy(&thermal_idr_lock); + mutex_destroy(&thermal_list_lock); + mutex_destroy(&thermal_governor_lock); return result; } static void __exit thermal_exit(void) { + genetlink_exit(); class_unregister(&thermal_class); + thermal_unregister_governors(); idr_destroy(&thermal_tz_idr); idr_destroy(&thermal_cdev_idr); mutex_destroy(&thermal_idr_lock); mutex_destroy(&thermal_list_lock); - genetlink_exit(); + mutex_destroy(&thermal_governor_lock); } fs_initcall(thermal_init); diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 0d3205a18112..7cf2f6626251 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -50,4 +50,31 @@ struct thermal_instance { struct list_head cdev_node; /* node in cdev->thermal_instances */ }; +int thermal_register_governor(struct thermal_governor *); +void thermal_unregister_governor(struct thermal_governor *); + +#ifdef CONFIG_THERMAL_GOV_STEP_WISE +int thermal_gov_step_wise_register(void); +void thermal_gov_step_wise_unregister(void); +#else +static inline int thermal_gov_step_wise_register(void) { return 0; } +static inline void thermal_gov_step_wise_unregister(void) {} +#endif /* CONFIG_THERMAL_GOV_STEP_WISE */ + +#ifdef CONFIG_THERMAL_GOV_FAIR_SHARE +int thermal_gov_fair_share_register(void); +void thermal_gov_fair_share_unregister(void); +#else +static inline int thermal_gov_fair_share_register(void) { return 0; } +static inline void thermal_gov_fair_share_unregister(void) {} +#endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */ + +#ifdef CONFIG_THERMAL_GOV_USER_SPACE +int thermal_gov_user_space_register(void); +void thermal_gov_user_space_unregister(void); +#else +static inline int thermal_gov_user_space_register(void) { return 0; } +static inline void thermal_gov_user_space_unregister(void) {} +#endif /* CONFIG_THERMAL_GOV_USER_SPACE */ + #endif /* __THERMAL_CORE_H__ */ diff --git a/drivers/thermal/user_space.c b/drivers/thermal/user_space.c index 6bbb380b6d19..10adcddc8821 100644 --- a/drivers/thermal/user_space.c +++ b/drivers/thermal/user_space.c @@ -22,9 +22,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include #include #include "thermal_core.h" @@ -46,23 +43,15 @@ static int notify_user_space(struct thermal_zone_device *tz, int trip) static struct thermal_governor thermal_gov_user_space = { .name = "user_space", .throttle = notify_user_space, - .owner = THIS_MODULE, }; -static int __init thermal_gov_user_space_init(void) +int thermal_gov_user_space_register(void) { return thermal_register_governor(&thermal_gov_user_space); } -static void __exit thermal_gov_user_space_exit(void) +void thermal_gov_user_space_unregister(void) { thermal_unregister_governor(&thermal_gov_user_space); } -/* This should load after thermal framework */ -fs_initcall(thermal_gov_user_space_init); -module_exit(thermal_gov_user_space_exit); - -MODULE_AUTHOR("Durgadoss R"); -MODULE_DESCRIPTION("A user space Thermal notifier"); -MODULE_LICENSE("GPL"); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 5a3b428daaab..4445b951b57e 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -187,7 +187,6 @@ struct thermal_governor { char name[THERMAL_NAME_LENGTH]; int (*throttle)(struct thermal_zone_device *tz, int trip); struct list_head governor_list; - struct module *owner; }; /* Structure that holds binding parameters for a zone */ @@ -247,9 +246,6 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, void thermal_cdev_update(struct thermal_cooling_device *); void notify_thermal_framework(struct thermal_zone_device *, int); -int thermal_register_governor(struct thermal_governor *); -void thermal_unregister_governor(struct thermal_governor *); - #ifdef CONFIG_NET extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, enum events event); -- cgit v1.2.3-59-g8ed1b From bbf7fc88c78f7317e2cdcf77e974c8a9a8312641 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Tue, 26 Mar 2013 23:57:01 +0800 Subject: Thermal: build cpu_cooling code into thermal_sys module Signed-off-by: Zhang Rui Acked-by: Eduardo Valentin Acked-by: Durgadoss R --- drivers/thermal/Kconfig | 2 +- drivers/thermal/Makefile | 2 +- include/linux/cpu_cooling.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index fb0672baff40..d1c2160492aa 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -67,7 +67,7 @@ config THERMAL_GOV_USER_SPACE Enable this to let the user space manage the platform thermals. config CPU_THERMAL - tristate "generic cpu cooling support" + bool "generic cpu cooling support" depends on CPU_FREQ select CPU_FREQ_TABLE help diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index b17bfb055498..c054d410ac3f 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -11,7 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE) += step_wise.o thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE) += user_space.o # cpufreq cooling -obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o +thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index bc479b1e0fd9..77c87c9d0193 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -29,7 +29,7 @@ #define CPUFREQ_COOLING_START 0 #define CPUFREQ_COOLING_STOP 1 -#if defined(CONFIG_CPU_THERMAL) || defined(CONFIG_CPU_THERMAL_MODULE) +#ifdef CONFIG_CPU_THERMAL /** * cpufreq_cooling_register - function to create cpufreq cooling device. * @clip_cpus: cpumask of cpus where the frequency constraints will happen -- cgit v1.2.3-59-g8ed1b From 63c4d919cf66b1b3ffa7861bddb50a697914af5b Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Fri, 5 Apr 2013 12:32:28 +0000 Subject: thermal: introduce thermal_zone_get_zone_by_name helper function This patch adds a helper function to get a reference of a thermal zone, based on the zone type name. It will perform a zone name lookup and return a reference to a thermal zone device that matches the name requested. In case the zone is not found or when several zones match same name or if the required parameters are invalid, it will return the corresponding error code (ERR_PTR). Cc: Durgadoss R Signed-off-by: Eduardo Valentin Acked-by: Durgadoss R Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 38 ++++++++++++++++++++++++++++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 39 insertions(+) (limited to 'include') diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 4cdc3e327222..5045473485cf 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1754,6 +1754,44 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) } EXPORT_SYMBOL(thermal_zone_device_unregister); +/** + * thermal_zone_get_zone_by_name() - search for a zone and returns its ref + * @name: thermal zone name to fetch the temperature + * + * When only one zone is found with the passed name, returns a reference to it. + * + * Return: On success returns a reference to an unique thermal zone with + * matching name equals to @name, an ERR_PTR otherwise (-EINVAL for invalid + * paramenters, -ENODEV for not found and -EEXIST for multiple matches). + */ +struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name) +{ + struct thermal_zone_device *pos = NULL, *ref = ERR_PTR(-EINVAL); + unsigned int found = 0; + + if (!name) + goto exit; + + mutex_lock(&thermal_list_lock); + list_for_each_entry(pos, &thermal_tz_list, node) + if (!strnicmp(name, pos->type, THERMAL_NAME_LENGTH)) { + found++; + ref = pos; + } + mutex_unlock(&thermal_list_lock); + + /* nothing has been found, thus an error code for it */ + if (found == 0) + ref = ERR_PTR(-ENODEV); + else if (found > 1) + /* Success only when an unique zone is found */ + ref = ERR_PTR(-EEXIST); + +exit: + return ref; +} +EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name); + #ifdef CONFIG_NET static struct genl_family thermal_event_genl_family = { .id = GENL_ID_GENERATE, diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 3bda306f7a50..9af2f3a99658 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -239,6 +239,7 @@ void thermal_zone_device_update(struct thermal_zone_device *); struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, const struct thermal_cooling_device_ops *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); +struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, -- cgit v1.2.3-59-g8ed1b From 837b26bb2e4a83d224e725f07a1d9ca824bf905c Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Fri, 5 Apr 2013 12:32:29 +0000 Subject: thermal: expose thermal_zone_get_temp API This patch exports the thermal_zone_get_temp API so that driver writers can fetch temperature of thermal zones managed by other drivers. Acked-by: Durgadoss R Signed-off-by: Eduardo Valentin Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 20 +++++++++++++++++--- include/linux/thermal.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5045473485cf..c0779adb2459 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -369,16 +369,28 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) monitor_thermal_zone(tz); } -static int thermal_zone_get_temp(struct thermal_zone_device *tz, - unsigned long *temp) +/** + * thermal_zone_get_temp() - returns its the temperature of thermal zone + * @tz: a valid pointer to a struct thermal_zone_device + * @temp: a valid pointer to where to store the resulting temperature. + * + * When a valid thermal zone reference is passed, it will fetch its + * temperature and fill @temp. + * + * Return: On success returns 0, an error code otherwise + */ +int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp) { - int ret = 0; + int ret = -EINVAL; #ifdef CONFIG_THERMAL_EMULATION int count; unsigned long crit_temp = -1UL; enum thermal_trip_type type; #endif + if (IS_ERR_OR_NULL(tz)) + goto exit; + mutex_lock(&tz->lock); ret = tz->ops->get_temp(tz, temp); @@ -402,8 +414,10 @@ static int thermal_zone_get_temp(struct thermal_zone_device *tz, skip_emul: #endif mutex_unlock(&tz->lock); +exit: return ret; } +EXPORT_SYMBOL_GPL(thermal_zone_get_temp); static void update_temperature(struct thermal_zone_device *tz) { diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 9af2f3a99658..ec2b886f9d96 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -240,6 +240,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, const struct thermal_cooling_device_ops *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); +int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp); int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, -- cgit v1.2.3-59-g8ed1b From 198f38f7fb2d0956cc3394655d03cdb7054b0dcd Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Wed, 24 Apr 2013 23:10:28 +0800 Subject: thermal: cpu_cooling: add needed header for cpu_cooling.h Update header list for cpu_cooling.h. Missing definition of cpumask. Signed-off-by: Eduardo Valentin Acked-by: Amit Daniel Kachhap Signed-off-by: Zhang Rui --- include/linux/cpu_cooling.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index 77c87c9d0193..75ef931fc4fc 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -25,6 +25,7 @@ #define __CPU_COOLING_H__ #include +#include #define CPUFREQ_COOLING_START 0 #define CPUFREQ_COOLING_STOP 1 -- cgit v1.2.3-59-g8ed1b From e44dec77be9e032ff9c2f95f17f7df3a55b58f60 Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Wed, 17 Apr 2013 17:12:22 +0000 Subject: thermal: cpu_cooling: remove unused symbols on cpu_cooling.h Remove defines that are not in used. Signed-off-by: Eduardo Valentin Acked-by: Amit Daniel Kachhap Signed-off-by: Zhang Rui --- include/linux/cpu_cooling.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index 75ef931fc4fc..f48f6fbcd3be 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -27,9 +27,6 @@ #include #include -#define CPUFREQ_COOLING_START 0 -#define CPUFREQ_COOLING_STOP 1 - #ifdef CONFIG_CPU_THERMAL /** * cpufreq_cooling_register - function to create cpufreq cooling device. -- cgit v1.2.3-59-g8ed1b From 7b73c993776b9f7d833dde7d09fd861508c54777 Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Tue, 23 Apr 2013 21:48:14 +0000 Subject: thermal: rename notify_thermal_framework to thermal_notify_framework To follow the prefix names used by the thermal functions, this patch renames notify_thermal_framework to thermal_notify_framework. Signed-off-by: Eduardo Valentin Signed-off-by: Zhang Rui --- Documentation/thermal/sysfs-api.txt | 2 +- drivers/thermal/thermal_core.c | 6 +++--- include/linux/thermal.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt index b2ffe98cf469..bb42266afc66 100644 --- a/Documentation/thermal/sysfs-api.txt +++ b/Documentation/thermal/sysfs-api.txt @@ -367,7 +367,7 @@ This function returns the thermal_instance corresponding to a given {thermal_zone, cooling_device, trip_point} combination. Returns NULL if such an instance does not exist. -5.3:notify_thermal_framework: +5.3:thermal_notify_framework: This function handles the trip events from sensor drivers. It starts throttling the cooling devices according to the policy configured. For CRITICAL and HOT trip points, this notifies the respective drivers, diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a579c622f1a7..fb22ae51aac2 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1432,7 +1432,7 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) EXPORT_SYMBOL(thermal_cdev_update); /** - * notify_thermal_framework - Sensor drivers use this API to notify framework + * thermal_notify_framework - Sensor drivers use this API to notify framework * @tz: thermal zone device * @trip: indicates which trip point has been crossed * @@ -1443,11 +1443,11 @@ EXPORT_SYMBOL(thermal_cdev_update); * The throttling policy is based on the configured platform data; if no * platform data is provided, this uses the step_wise throttling policy. */ -void notify_thermal_framework(struct thermal_zone_device *tz, int trip) +void thermal_notify_framework(struct thermal_zone_device *tz, int trip) { handle_thermal_trip(tz, trip); } -EXPORT_SYMBOL(notify_thermal_framework); +EXPORT_SYMBOL(thermal_notify_framework); /** * create_trip_attrs - create attributes for trip points diff --git a/include/linux/thermal.h b/include/linux/thermal.h index ec2b886f9d96..d7272ab20ebc 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -246,7 +246,7 @@ 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 *); -void notify_thermal_framework(struct thermal_zone_device *, int); +void thermal_notify_framework(struct thermal_zone_device *, int); #ifdef CONFIG_NET extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, -- cgit v1.2.3-59-g8ed1b From d44ada516277f5d58b9bda2ea0a2c9503b316bbf Mon Sep 17 00:00:00 2001 From: Eduardo Valentin Date: Wed, 17 Apr 2013 17:12:23 +0000 Subject: thermal: cpu_cooling: improve line breaking To improve code readiness, change the way the lines are broken in this file. Signed-off-by: Eduardo Valentin Signed-off-by: Zhang Rui --- include/linux/cpu_cooling.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index f48f6fbcd3be..282e27028418 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -32,8 +32,8 @@ * cpufreq_cooling_register - function to create cpufreq cooling device. * @clip_cpus: cpumask of cpus where the frequency constraints will happen */ -struct thermal_cooling_device *cpufreq_cooling_register( - const struct cpumask *clip_cpus); +struct thermal_cooling_device * +cpufreq_cooling_register(const struct cpumask *clip_cpus); /** * cpufreq_cooling_unregister - function to remove cpufreq cooling device. @@ -43,18 +43,18 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); #else /* !CONFIG_CPU_THERMAL */ -static inline struct thermal_cooling_device *cpufreq_cooling_register( - const struct cpumask *clip_cpus) +static inline struct thermal_cooling_device * +cpufreq_cooling_register(const struct cpumask *clip_cpus) { return NULL; } -static inline void cpufreq_cooling_unregister( - struct thermal_cooling_device *cdev) +static inline +void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { return; } -static inline unsigned long cpufreq_cooling_get_level(unsigned int, - unsigned int) +static inline +unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) { return THERMAL_CSTATE_INVALID; } -- cgit v1.2.3-59-g8ed1b