aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index c99c00d35d34..a0b2f7e0eedb 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -18,7 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/stat.h> 20#include <linux/stat.h>
21#include <linux/opp.h> 21#include <linux/pm_opp.h>
22#include <linux/devfreq.h> 22#include <linux/devfreq.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
@@ -902,13 +902,13 @@ static ssize_t available_frequencies_show(struct device *d,
902{ 902{
903 struct devfreq *df = to_devfreq(d); 903 struct devfreq *df = to_devfreq(d);
904 struct device *dev = df->dev.parent; 904 struct device *dev = df->dev.parent;
905 struct opp *opp; 905 struct dev_pm_opp *opp;
906 ssize_t count = 0; 906 ssize_t count = 0;
907 unsigned long freq = 0; 907 unsigned long freq = 0;
908 908
909 rcu_read_lock(); 909 rcu_read_lock();
910 do { 910 do {
911 opp = opp_find_freq_ceil(dev, &freq); 911 opp = dev_pm_opp_find_freq_ceil(dev, &freq);
912 if (IS_ERR(opp)) 912 if (IS_ERR(opp))
913 break; 913 break;
914 914
@@ -993,10 +993,10 @@ static int __init devfreq_init(void)
993 } 993 }
994 994
995 devfreq_wq = create_freezable_workqueue("devfreq_wq"); 995 devfreq_wq = create_freezable_workqueue("devfreq_wq");
996 if (IS_ERR(devfreq_wq)) { 996 if (!devfreq_wq) {
997 class_destroy(devfreq_class); 997 class_destroy(devfreq_class);
998 pr_err("%s: couldn't create workqueue\n", __FILE__); 998 pr_err("%s: couldn't create workqueue\n", __FILE__);
999 return PTR_ERR(devfreq_wq); 999 return -ENOMEM;
1000 } 1000 }
1001 devfreq_class->dev_groups = devfreq_groups; 1001 devfreq_class->dev_groups = devfreq_groups;
1002 1002
@@ -1029,25 +1029,26 @@ module_exit(devfreq_exit);
1029 * under the locked area. The pointer returned must be used prior to unlocking 1029 * under the locked area. The pointer returned must be used prior to unlocking
1030 * with rcu_read_unlock() to maintain the integrity of the pointer. 1030 * with rcu_read_unlock() to maintain the integrity of the pointer.
1031 */ 1031 */
1032struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, 1032struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
1033 u32 flags) 1033 unsigned long *freq,
1034 u32 flags)
1034{ 1035{
1035 struct opp *opp; 1036 struct dev_pm_opp *opp;
1036 1037
1037 if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) { 1038 if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
1038 /* The freq is an upper bound. opp should be lower */ 1039 /* The freq is an upper bound. opp should be lower */
1039 opp = opp_find_freq_floor(dev, freq); 1040 opp = dev_pm_opp_find_freq_floor(dev, freq);
1040 1041
1041 /* If not available, use the closest opp */ 1042 /* If not available, use the closest opp */
1042 if (opp == ERR_PTR(-ERANGE)) 1043 if (opp == ERR_PTR(-ERANGE))
1043 opp = opp_find_freq_ceil(dev, freq); 1044 opp = dev_pm_opp_find_freq_ceil(dev, freq);
1044 } else { 1045 } else {
1045 /* The freq is an lower bound. opp should be higher */ 1046 /* The freq is an lower bound. opp should be higher */
1046 opp = opp_find_freq_ceil(dev, freq); 1047 opp = dev_pm_opp_find_freq_ceil(dev, freq);
1047 1048
1048 /* If not available, use the closest opp */ 1049 /* If not available, use the closest opp */
1049 if (opp == ERR_PTR(-ERANGE)) 1050 if (opp == ERR_PTR(-ERANGE))
1050 opp = opp_find_freq_floor(dev, freq); 1051 opp = dev_pm_opp_find_freq_floor(dev, freq);
1051 } 1052 }
1052 1053
1053 return opp; 1054 return opp;
@@ -1066,7 +1067,7 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
1066 int ret = 0; 1067 int ret = 0;
1067 1068
1068 rcu_read_lock(); 1069 rcu_read_lock();
1069 nh = opp_get_notifier(dev); 1070 nh = dev_pm_opp_get_notifier(dev);
1070 if (IS_ERR(nh)) 1071 if (IS_ERR(nh))
1071 ret = PTR_ERR(nh); 1072 ret = PTR_ERR(nh);
1072 rcu_read_unlock(); 1073 rcu_read_unlock();
@@ -1092,7 +1093,7 @@ int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)
1092 int ret = 0; 1093 int ret = 0;
1093 1094
1094 rcu_read_lock(); 1095 rcu_read_lock();
1095 nh = opp_get_notifier(dev); 1096 nh = dev_pm_opp_get_notifier(dev);
1096 if (IS_ERR(nh)) 1097 if (IS_ERR(nh))
1097 ret = PTR_ERR(nh); 1098 ret = PTR_ERR(nh);
1098 rcu_read_unlock(); 1099 rcu_read_unlock();