Skip to contentSkip to conversation

usb: chipidea: msm: Use device-managed registration API

PATCH Superseded Chuhong Yuan 2 participants 4 messages Jul 23, 2019 – Aug 29, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: chipidea: msm: Use device-managed registration API

Use devm_reset_controller_register to get rid
of manual unregistration.

---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_msm.c +1 -3
index bb4645a8ca46..067542e84aea 100644
@@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 	ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
 	ci->rcdev.of_node = pdev->dev.of_node;
 	ci->rcdev.nr_resets = 2;
-	ret = reset_controller_register(&ci->rcdev);
+	ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
 	if (ret)
 		return ret;
 
@@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 err_iface:
 	clk_disable_unprepare(ci->core_clk);
 err_fs:
-	reset_controller_unregister(&ci->rcdev);
 	return ret;
 }
 
@@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
 	ci_hdrc_remove_device(ci->ci);
 	clk_disable_unprepare(ci->iface_clk);
 	clk_disable_unprepare(ci->core_clk);
-	reset_controller_unregister(&ci->rcdev);
 
 	return 0;
 }
Signature · 1 line
2.20.1
#1 lore raw
Quoted 22 lines · Chuhong Yuan

Use devm_reset_controller_register to get rid
of manual unregistration.

---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_msm.c +1 -1
index bb4645a8ca46..067542e84aea 100644
@@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 	ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
 	ci->rcdev.of_node = pdev->dev.of_node;
 	ci->rcdev.nr_resets = 2;
-	ret = reset_controller_register(&ci->rcdev);
+	ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
 	if (ret)
 		return ret;
 

drivers/usb/chipidea/ci_hdrc_msm.c static int ci_hdrc_msm_probe(struct platform_device *pdev) · line 275

Quoted 4 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -1
@@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 err_iface:
 	clk_disable_unprepare(ci->core_clk);
 err_fs:
-	reset_controller_unregister(&ci->rcdev);

It is devm API, why the unregister needs to be called at fail path?

Peter

Quoted 14 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -1
 	return ret;
 }
 
@@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
 	ci_hdrc_remove_device(ci->ci);
 	clk_disable_unprepare(ci->iface_clk);
 	clk_disable_unprepare(ci->core_clk);
-	reset_controller_unregister(&ci->rcdev);
 
 	return 0;
 }
Signature · 1 line
2.20.1
#2 lore raw
Quoted 23 lines · Peter Chen
Quoted 21 lines · Chuhong Yuan

Use devm_reset_controller_register to get rid
of manual unregistration.

---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_msm.c +1 -1
index bb4645a8ca46..067542e84aea 100644
@@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
      ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
      ci->rcdev.of_node = pdev->dev.of_node;
      ci->rcdev.nr_resets = 2;
-     ret = reset_controller_register(&ci->rcdev);
+     ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
      if (ret)
              return ret;
 
Quoted 9 lines

drivers/usb/chipidea/ci_hdrc_msm.c static int ci_hdrc_msm_probe(struct platform_device *pdev) · line 275

Quoted 5 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -1
@@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 err_iface:
      clk_disable_unprepare(ci->core_clk);
 err_fs:
-     reset_controller_unregister(&ci->rcdev);

It is devm API, why the unregister needs to be called at fail path?

I am not very clear about your problem...
After using devm_reset_controller_register(), I have removed reset_controller_unregister() calls
in this patch.

Quoted 16 lines

Peter

Quoted 14 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -2
      return ret;
 }
 
@@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
      ci_hdrc_remove_device(ci->ci);
      clk_disable_unprepare(ci->iface_clk);
      clk_disable_unprepare(ci->core_clk);
-     reset_controller_unregister(&ci->rcdev);
 
      return 0;
 }
--

2.20.1

#3 lore raw
Quoted 34 lines · Chuhong Yuan
Quoted 23 lines · Peter Chen
Quoted 21 lines · Chuhong Yuan

Use devm_reset_controller_register to get rid
of manual unregistration.

---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/chipidea/ci_hdrc_msm.c +1 -1
index bb4645a8ca46..067542e84aea 100644
@@ -216,7 +216,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
      ci->rcdev.ops = &ci_hdrc_msm_reset_ops;
      ci->rcdev.of_node = pdev->dev.of_node;
      ci->rcdev.nr_resets = 2;
-     ret = reset_controller_register(&ci->rcdev);
+     ret = devm_reset_controller_register(&pdev->dev, &ci->rcdev);
      if (ret)
              return ret;
 
Quoted 9 lines

drivers/usb/chipidea/ci_hdrc_msm.c static int ci_hdrc_msm_probe(struct platform_device *pdev) · line 275

Quoted 5 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -1
@@ -272,7 +272,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 err_iface:
      clk_disable_unprepare(ci->core_clk);
 err_fs:
-     reset_controller_unregister(&ci->rcdev);

It is devm API, why the unregister needs to be called at fail path?

Quoted 5 lines

I am not very clear about your problem...
After using devm_reset_controller_register(), I have removed reset_controller_unregister() calls
in this patch.

Sorry, my fault.

Your patch is ok, but try to clean up the label "err_fs" since it is not needed.

Peter

Quoted 16 lines
Quoted 16 lines

Peter

Quoted 14 lines
drivers/usb/chipidea/ci_hdrc_msm.c +0 -2
      return ret;
 }
 
@@ -284,7 +283,6 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
      ci_hdrc_remove_device(ci->ci);
      clk_disable_unprepare(ci->iface_clk);
      clk_disable_unprepare(ci->core_clk);
-     reset_controller_unregister(&ci->rcdev);
 
      return 0;
 }
--

2.20.1