summaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-26 16:21:28 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-26 16:21:28 +0100
commit92043eafcfc5ad06581d12c151fa7e18240378fa (patch)
tree5419f47a393c633b8548bef134f361681cdeb9c6 /drivers/devfreq
parent8a531b0243cf78f1a5dd8f31762c1c493a800311 (diff)
parentf9c08e2acbbed19ecafc82e4549b7040cc549216 (diff)
downloadlinux-92043eafcfc5ad06581d12c151fa7e18240378fa.tar.gz
linux-92043eafcfc5ad06581d12c151fa7e18240378fa.tar.bz2
linux-92043eafcfc5ad06581d12c151fa7e18240378fa.zip
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
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c30
1 files changed, 22 insertions, 8 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)
g = find_devfreq_governor(governor->name);
if (IS_ERR(g)) {
pr_err("%s: governor %s not registered\n", __func__,
- g->name);
- err = -EINVAL;
+ governor->name);
+ err = PTR_ERR(g);
goto err_out;
}
list_for_each_entry(devfreq, &devfreq_list, node) {
@@ -1023,11 +1023,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
*/
int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
{
- struct srcu_notifier_head *nh = opp_get_notifier(dev);
+ struct srcu_notifier_head *nh;
+ int ret = 0;
+ rcu_read_lock();
+ nh = opp_get_notifier(dev);
if (IS_ERR(nh))
- return PTR_ERR(nh);
- return srcu_notifier_chain_register(nh, &devfreq->nb);
+ ret = PTR_ERR(nh);
+ rcu_read_unlock();
+ if (!ret)
+ ret = srcu_notifier_chain_register(nh, &devfreq->nb);
+
+ return ret;
}
/**
@@ -1042,11 +1049,18 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
*/
int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)
{
- struct srcu_notifier_head *nh = opp_get_notifier(dev);
+ struct srcu_notifier_head *nh;
+ int ret = 0;
+ rcu_read_lock();
+ nh = opp_get_notifier(dev);
if (IS_ERR(nh))
- return PTR_ERR(nh);
- return srcu_notifier_chain_unregister(nh, &devfreq->nb);
+ ret = PTR_ERR(nh);
+ rcu_read_unlock();
+ if (!ret)
+ ret = srcu_notifier_chain_unregister(nh, &devfreq->nb);
+
+ return ret;
}
MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");