diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-26 10:21:28 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-26 10:21:28 -0500 |
commit | 92043eafcfc5ad06581d12c151fa7e18240378fa (patch) | |
tree | 5419f47a393c633b8548bef134f361681cdeb9c6 | |
parent | 8a531b0243cf78f1a5dd8f31762c1c493a800311 (diff) | |
parent | f9c08e2acbbed19ecafc82e4549b7040cc549216 (diff) |
Merge tag 'pull_req_20121126' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq into pm-devfreq
Pull devfreq changes from MyungJoo Ham.
* tag 'pull_req_20121126' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq:
PM / devfreq: Fix return value in devfreq_remove_governor()
PM / devfreq: Fix incorrect argument in error message
PM / devfreq: missing rcu_read_lock() added for find_device_opp()
PM / devfreq: remove compiler error when a governor is module
-rw-r--r-- | drivers/devfreq/devfreq.c | 30 | ||||
-rw-r--r-- | include/linux/devfreq.h | 2 |
2 files changed, 23 insertions, 9 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 45e053e5b139..34c00c53611f 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
@@ -643,8 +643,8 @@ int devfreq_remove_governor(struct devfreq_governor *governor) | |||
643 | g = find_devfreq_governor(governor->name); | 643 | g = find_devfreq_governor(governor->name); |
644 | if (IS_ERR(g)) { | 644 | if (IS_ERR(g)) { |
645 | pr_err("%s: governor %s not registered\n", __func__, | 645 | pr_err("%s: governor %s not registered\n", __func__, |
646 | g->name); | 646 | governor->name); |
647 | err = -EINVAL; | 647 | err = PTR_ERR(g); |
648 | goto err_out; | 648 | goto err_out; |
649 | } | 649 | } |
650 | list_for_each_entry(devfreq, &devfreq_list, node) { | 650 | list_for_each_entry(devfreq, &devfreq_list, node) { |
@@ -1023,11 +1023,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, | |||
1023 | */ | 1023 | */ |
1024 | int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) | 1024 | int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) |
1025 | { | 1025 | { |
1026 | struct srcu_notifier_head *nh = opp_get_notifier(dev); | 1026 | struct srcu_notifier_head *nh; |
1027 | int ret = 0; | ||
1027 | 1028 | ||
1029 | rcu_read_lock(); | ||
1030 | nh = opp_get_notifier(dev); | ||
1028 | if (IS_ERR(nh)) | 1031 | if (IS_ERR(nh)) |
1029 | return PTR_ERR(nh); | 1032 | ret = PTR_ERR(nh); |
1030 | return srcu_notifier_chain_register(nh, &devfreq->nb); | 1033 | rcu_read_unlock(); |
1034 | if (!ret) | ||
1035 | ret = srcu_notifier_chain_register(nh, &devfreq->nb); | ||
1036 | |||
1037 | return ret; | ||
1031 | } | 1038 | } |
1032 | 1039 | ||
1033 | /** | 1040 | /** |
@@ -1042,11 +1049,18 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) | |||
1042 | */ | 1049 | */ |
1043 | int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) | 1050 | int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) |
1044 | { | 1051 | { |
1045 | struct srcu_notifier_head *nh = opp_get_notifier(dev); | 1052 | struct srcu_notifier_head *nh; |
1053 | int ret = 0; | ||
1046 | 1054 | ||
1055 | rcu_read_lock(); | ||
1056 | nh = opp_get_notifier(dev); | ||
1047 | if (IS_ERR(nh)) | 1057 | if (IS_ERR(nh)) |
1048 | return PTR_ERR(nh); | 1058 | ret = PTR_ERR(nh); |
1049 | return srcu_notifier_chain_unregister(nh, &devfreq->nb); | 1059 | rcu_read_unlock(); |
1060 | if (!ret) | ||
1061 | ret = srcu_notifier_chain_unregister(nh, &devfreq->nb); | ||
1062 | |||
1063 | return ret; | ||
1050 | } | 1064 | } |
1051 | 1065 | ||
1052 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | 1066 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 235248cb2c93..e83ef39b3bea 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -192,7 +192,7 @@ extern int devfreq_register_opp_notifier(struct device *dev, | |||
192 | extern int devfreq_unregister_opp_notifier(struct device *dev, | 192 | extern int devfreq_unregister_opp_notifier(struct device *dev, |
193 | struct devfreq *devfreq); | 193 | struct devfreq *devfreq); |
194 | 194 | ||
195 | #ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND | 195 | #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) |
196 | /** | 196 | /** |
197 | * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq | 197 | * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq |
198 | * and devfreq_add_device | 198 | * and devfreq_add_device |