Skip to contentSkip to conversation

PM / devfreq: imx-bus: convert to use devm_pm_opp_* API

PATCH In review Yangtao Li 2 participants 2 messages Jan 3, 2021 – Jan 5, 2021

Subsystems (9)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 29/31 PM / devfreq: imx-bus: convert to use devm_pm_opp_* API

Use devm_pm_opp_* API to simplify code.

---
 drivers/devfreq/imx-bus.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/devfreq/imx-bus.c +3 -11
index 4f38455ad742..ff26ef049b1b 100644
@@ -61,7 +61,6 @@ static void imx_bus_exit(struct device *dev)
 {
 	struct imx_bus *priv = dev_get_drvdata(dev);
 
-	dev_pm_opp_of_remove_table(dev);
 	platform_device_unregister(priv->icc_pdev);
 }
 
@@ -123,7 +122,7 @@ static int imx_bus_probe(struct platform_device *pdev)
 	}
 	platform_set_drvdata(pdev, priv);
 
-	ret = dev_pm_opp_of_add_table(dev);
+	ret = devm_pm_opp_of_add_table(dev);
 	if (ret < 0) {
 		dev_err(dev, "failed to get OPP table\n");
 		return ret;
@@ -141,18 +140,11 @@ static int imx_bus_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->devfreq)) {
 		ret = PTR_ERR(priv->devfreq);
 		dev_err(dev, "failed to add devfreq device: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
-	ret = imx_bus_init_icc(dev);
-	if (ret)
-		goto err;
-
-	return 0;
+	return imx_bus_init_icc(dev);
 
-err:
-	dev_pm_opp_of_remove_table(dev);
-	return ret;
 }
 
 static const struct of_device_id imx_bus_of_match[] = {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 33 lines · Yangtao Li

Use devm_pm_opp_* API to simplify code.

---
 drivers/devfreq/imx-bus.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/devfreq/imx-bus.c +1 -2
index 4f38455ad742..ff26ef049b1b 100644
@@ -61,7 +61,6 @@ static void imx_bus_exit(struct device *dev)
 {
        struct imx_bus *priv = dev_get_drvdata(dev);
 
-       dev_pm_opp_of_remove_table(dev);
        platform_device_unregister(priv->icc_pdev);
 }
 
@@ -123,7 +122,7 @@ static int imx_bus_probe(struct platform_device *pdev)
        }
        platform_set_drvdata(pdev, priv);
 
-       ret = dev_pm_opp_of_add_table(dev);
+       ret = devm_pm_opp_of_add_table(dev);
        if (ret < 0) {
                dev_err(dev, "failed to get OPP table\n");
                return ret;
@@ -141,18 +140,11 @@ static int imx_bus_probe(struct platform_device *pdev)
        if (IS_ERR(priv->devfreq)) {
                ret = PTR_ERR(priv->devfreq);
                dev_err(dev, "failed to add devfreq device: %d\n", ret);

drivers/devfreq/imx-bus.c static int imx_bus_probe(struct platform_device *pdev) · line 146

Quoted 10 lines
drivers/devfreq/imx-bus.c +2 -6
-               goto err;
+               return ret;
        }
 
-       ret = imx_bus_init_icc(dev);
-       if (ret)
-               goto err;
-
-       return 0;
+       return imx_bus_init_icc(dev);

Remove the unneeded blank line under '.return imx_bus_init_icc(dev);".

Quoted 9 lines
drivers/devfreq/imx-bus.c +0 -4
-err:
-       dev_pm_opp_of_remove_table(dev);
-       return ret;
 }
 
 static const struct of_device_id imx_bus_of_match[] = {
--

2.25.1

Signature · 6 lines
Best Regards,
Chanwoo Choi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel