[PATCH] usb: dwc3: of-simple: use managed and shared reset control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This driver handles the reset control in a common manner; deassert
resets before use, assert them after use.  There is no good reason
why it should be exclusive.

Also, use devm_ for clean-up.

Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---

CCing Philipp Zabel.
I see his sob in commit 06c47e6286d5.


 drivers/usb/dwc3/dwc3-of-simple.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index e54c362..bd6ab65 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -91,7 +91,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, simple);
 	simple->dev = dev;
 
-	simple->resets = of_reset_control_array_get_optional_exclusive(np);
+	simple->resets = devm_reset_control_array_get_optional_shared(dev);
 	if (IS_ERR(simple->resets)) {
 		ret = PTR_ERR(simple->resets);
 		dev_err(dev, "failed to get device resets, err=%d\n", ret);
@@ -100,7 +100,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 
 	ret = reset_control_deassert(simple->resets);
 	if (ret)
-		goto err_resetc_put;
+		return ret;
 
 	ret = dwc3_of_simple_clk_init(simple, of_count_phandle_with_args(np,
 						"clocks", "#clock-cells"));
@@ -126,8 +126,6 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 err_resetc_assert:
 	reset_control_assert(simple->resets);
 
-err_resetc_put:
-	reset_control_put(simple->resets);
 	return ret;
 }
 
@@ -146,7 +144,6 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
 	simple->num_clocks = 0;
 
 	reset_control_assert(simple->resets);
-	reset_control_put(simple->resets);
 
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux