Merge branch 'pm-devfreq'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 7 Nov 2013 18:24:20 +0000 (19:24 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 7 Nov 2013 18:24:20 +0000 (19:24 +0100)
* pm-devfreq:
  PM / devfreq: create_freezable_workqueue() doesn't return an ERR_PTR
  PM / devfreq: Remove duplicate header file inclusion in exynos5_bus.c
  PM / devfreq: Use devm_* APIs in exynos5_bus.c
  PM / devfreq: Remove redundant platform_set_drvdata() in exynos5_bus.c
  PM / devfreq: Fix incorrect usage of IS_ERR_OR_NULL in exynos5_bus.c

1  2 
drivers/devfreq/devfreq.c
drivers/devfreq/exynos/exynos5_bus.c

index 2e23b12c350b8759c71ae1d5a438c9aaf2089166,22e5d2ffebd8627b75d5892b9547c981f0868deb..a0b2f7e0eedb774fbfa3e8fc0e41b73f10cfefd0
@@@ -18,7 -18,7 +18,7 @@@
  #include <linux/module.h>
  #include <linux/slab.h>
  #include <linux/stat.h>
 -#include <linux/opp.h>
 +#include <linux/pm_opp.h>
  #include <linux/devfreq.h>
  #include <linux/workqueue.h>
  #include <linux/platform_device.h>
@@@ -902,13 -902,13 +902,13 @@@ static ssize_t available_frequencies_sh
  {
        struct devfreq *df = to_devfreq(d);
        struct device *dev = df->dev.parent;
 -      struct opp *opp;
 +      struct dev_pm_opp *opp;
        ssize_t count = 0;
        unsigned long freq = 0;
  
        rcu_read_lock();
        do {
 -              opp = opp_find_freq_ceil(dev, &freq);
 +              opp = dev_pm_opp_find_freq_ceil(dev, &freq);
                if (IS_ERR(opp))
                        break;
  
@@@ -993,10 -993,10 +993,10 @@@ static int __init devfreq_init(void
        }
  
        devfreq_wq = create_freezable_workqueue("devfreq_wq");
-       if (IS_ERR(devfreq_wq)) {
+       if (!devfreq_wq) {
                class_destroy(devfreq_class);
                pr_err("%s: couldn't create workqueue\n", __FILE__);
-               return PTR_ERR(devfreq_wq);
+               return -ENOMEM;
        }
        devfreq_class->dev_groups = devfreq_groups;
  
@@@ -1029,26 -1029,25 +1029,26 @@@ module_exit(devfreq_exit)
   * under the locked area. The pointer returned must be used prior to unlocking
   * with rcu_read_unlock() to maintain the integrity of the pointer.
   */
 -struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
 -                                  u32 flags)
 +struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
 +                                         unsigned long *freq,
 +                                         u32 flags)
  {
 -      struct opp *opp;
 +      struct dev_pm_opp *opp;
  
        if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
                /* The freq is an upper bound. opp should be lower */
 -              opp = opp_find_freq_floor(dev, freq);
 +              opp = dev_pm_opp_find_freq_floor(dev, freq);
  
                /* If not available, use the closest opp */
                if (opp == ERR_PTR(-ERANGE))
 -                      opp = opp_find_freq_ceil(dev, freq);
 +                      opp = dev_pm_opp_find_freq_ceil(dev, freq);
        } else {
                /* The freq is an lower bound. opp should be higher */
 -              opp = opp_find_freq_ceil(dev, freq);
 +              opp = dev_pm_opp_find_freq_ceil(dev, freq);
  
                /* If not available, use the closest opp */
                if (opp == ERR_PTR(-ERANGE))
 -                      opp = opp_find_freq_floor(dev, freq);
 +                      opp = dev_pm_opp_find_freq_floor(dev, freq);
        }
  
        return opp;
@@@ -1067,7 -1066,7 +1067,7 @@@ int devfreq_register_opp_notifier(struc
        int ret = 0;
  
        rcu_read_lock();
 -      nh = opp_get_notifier(dev);
 +      nh = dev_pm_opp_get_notifier(dev);
        if (IS_ERR(nh))
                ret = PTR_ERR(nh);
        rcu_read_unlock();
@@@ -1093,7 -1092,7 +1093,7 @@@ int devfreq_unregister_opp_notifier(str
        int ret = 0;
  
        rcu_read_lock();
 -      nh = opp_get_notifier(dev);
 +      nh = dev_pm_opp_get_notifier(dev);
        if (IS_ERR(nh))
                ret = PTR_ERR(nh);
        rcu_read_unlock();
index 0e0bfc17cd5be9c291af51f8d2207958788991aa,04c164eecf2531eee25726ab5e297d8aa438b189..a60da3c1c48eef09dca3c2bb8322d429be1ab568
@@@ -15,7 -15,7 +15,7 @@@
  #include <linux/module.h>
  #include <linux/devfreq.h>
  #include <linux/io.h>
 -#include <linux/opp.h>
 +#include <linux/pm_opp.h>
  #include <linux/slab.h>
  #include <linux/suspend.h>
  #include <linux/clk.h>
@@@ -131,7 -131,7 +131,7 @@@ static int exynos5_busfreq_int_target(s
        struct platform_device *pdev = container_of(dev, struct platform_device,
                                                    dev);
        struct busfreq_data_int *data = platform_get_drvdata(pdev);
 -      struct opp *opp;
 +      struct dev_pm_opp *opp;
        unsigned long old_freq, freq;
        unsigned long volt;
  
                return PTR_ERR(opp);
        }
  
 -      freq = opp_get_freq(opp);
 -      volt = opp_get_voltage(opp);
 +      freq = dev_pm_opp_get_freq(opp);
 +      volt = dev_pm_opp_get_voltage(opp);
        rcu_read_unlock();
  
        old_freq = data->curr_freq;
@@@ -245,7 -245,7 +245,7 @@@ static int exynos5250_init_int_tables(s
        int i, err = 0;
  
        for (i = LV_0; i < _LV_END; i++) {
 -              err = opp_add(data->dev, exynos5_int_opp_table[i].clk,
 +              err = dev_pm_opp_add(data->dev, exynos5_int_opp_table[i].clk,
                                exynos5_int_opp_table[i].volt);
                if (err) {
                        dev_err(data->dev, "Cannot add opp entries.\n");
@@@ -261,7 -261,7 +261,7 @@@ static int exynos5_busfreq_int_pm_notif
  {
        struct busfreq_data_int *data = container_of(this,
                                        struct busfreq_data_int, pm_notifier);
 -      struct opp *opp;
 +      struct dev_pm_opp *opp;
        unsigned long maxfreq = ULONG_MAX;
        unsigned long freq;
        unsigned long volt;
                data->disabled = true;
  
                rcu_read_lock();
 -              opp = opp_find_freq_floor(data->dev, &maxfreq);
 +              opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq);
                if (IS_ERR(opp)) {
                        rcu_read_unlock();
                        err = PTR_ERR(opp);
                        goto unlock;
                }
 -              freq = opp_get_freq(opp);
 -              volt = opp_get_voltage(opp);
 +              freq = dev_pm_opp_get_freq(opp);
 +              volt = dev_pm_opp_get_voltage(opp);
                rcu_read_unlock();
  
                err = exynos5_int_setvolt(data, volt);
@@@ -315,7 -315,7 +315,7 @@@ unlock
  static int exynos5_busfreq_int_probe(struct platform_device *pdev)
  {
        struct busfreq_data_int *data;
 -      struct opp *opp;
 +      struct dev_pm_opp *opp;
        struct device *dev = &pdev->dev;
        struct device_node *np;
        unsigned long initial_freq;
  
        err = exynos5250_init_int_tables(data);
        if (err)
-               goto err_regulator;
+               return err;
  
-       data->vdd_int = regulator_get(dev, "vdd_int");
+       data->vdd_int = devm_regulator_get(dev, "vdd_int");
        if (IS_ERR(data->vdd_int)) {
                dev_err(dev, "Cannot get the regulator \"vdd_int\"\n");
-               err = PTR_ERR(data->vdd_int);
-               goto err_regulator;
+               return PTR_ERR(data->vdd_int);
        }
  
-       data->int_clk = clk_get(dev, "int_clk");
+       data->int_clk = devm_clk_get(dev, "int_clk");
        if (IS_ERR(data->int_clk)) {
                dev_err(dev, "Cannot get clock \"int_clk\"\n");
-               err = PTR_ERR(data->int_clk);
-               goto err_clock;
+               return PTR_ERR(data->int_clk);
        }
  
        rcu_read_lock();
 -      opp = opp_find_freq_floor(dev,
 +      opp = dev_pm_opp_find_freq_floor(dev,
                        &exynos5_devfreq_int_profile.initial_freq);
        if (IS_ERR(opp)) {
                rcu_read_unlock();
                dev_err(dev, "Invalid initial frequency %lu kHz.\n",
                       exynos5_devfreq_int_profile.initial_freq);
-               err = PTR_ERR(opp);
-               goto err_opp_add;
+               return PTR_ERR(opp);
        }
 -      initial_freq = opp_get_freq(opp);
 -      initial_volt = opp_get_voltage(opp);
 +      initial_freq = dev_pm_opp_get_freq(opp);
 +      initial_volt = dev_pm_opp_get_voltage(opp);
        rcu_read_unlock();
        data->curr_freq = initial_freq;
  
        err = clk_set_rate(data->int_clk, initial_freq * 1000);
        if (err) {
                dev_err(dev, "Failed to set initial frequency\n");
-               goto err_opp_add;
+               return err;
        }
  
        err = exynos5_int_setvolt(data, initial_volt);
        if (err)
-               goto err_opp_add;
+               return err;
  
        platform_set_drvdata(pdev, data);
  
  
  err_devfreq_add:
        devfreq_remove_device(data->devfreq);
-       platform_set_drvdata(pdev, NULL);
- err_opp_add:
-       clk_put(data->int_clk);
- err_clock:
-       regulator_put(data->vdd_int);
- err_regulator:
        return err;
  }
  
@@@ -434,9 -425,6 +425,6 @@@ static int exynos5_busfreq_int_remove(s
        pm_qos_remove_request(&data->int_req);
        unregister_pm_notifier(&data->pm_notifier);
        devfreq_remove_device(data->devfreq);
-       regulator_put(data->vdd_int);
-       clk_put(data->int_clk);
-       platform_set_drvdata(pdev, NULL);
  
        return 0;
  }
@@@ -478,7 -466,7 +466,7 @@@ static int __init exynos5_busfreq_int_i
  
        exynos5_devfreq_pdev =
                platform_device_register_simple("exynos5-bus-int", -1, NULL, 0);
-       if (IS_ERR_OR_NULL(exynos5_devfreq_pdev)) {
+       if (IS_ERR(exynos5_devfreq_pdev)) {
                ret = PTR_ERR(exynos5_devfreq_pdev);
                goto out1;
        }