[v2,2/7] usb: cdns3-ti: remove runtime PM

Message ID 20231120-j7200-usb-suspend-v2-2-038c7e4a3df4@bootlin.com
State New
Headers
Series usb: cdns: fix suspend on J7200 by assuming reset-on-resume |

Commit Message

Théo Lebrun Nov. 20, 2023, 5:06 p.m. UTC
  The driver does not use RPM. It enables it & gets a reference at probe.
It then undoes that on probe error or at remove.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 drivers/usb/cdns3/cdns3-ti.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
  

Comments

Kevin Hilman Nov. 22, 2023, 11:42 p.m. UTC | #1
Théo Lebrun <theo.lebrun@bootlin.com> writes:

> The driver does not use RPM. It enables it & gets a reference at probe.
> It then undoes that on probe error or at remove.

...which is a fairly standard thing to do for a rudimentary runtime PM
support on platforms that use power domains.

This will likely (almost surely) break other platforms.

Without a runtime PM get call, the power domain that this device is in
could be powered off without this driver ever knowing about it, causing
a crash as soon as the driver is used after the domain is turned off.

Kevin
  

Patch

diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 5945c4b1e11f..dc1594acdcee 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -135,13 +135,6 @@  static int cdns_ti_probe(struct platform_device *pdev)
 
 	rate_code = i;
 
-	pm_runtime_enable(dev);
-	error = pm_runtime_get_sync(dev);
-	if (error < 0) {
-		dev_err(dev, "pm_runtime_get_sync failed: %d\n", error);
-		goto err;
-	}
-
 	/* assert RESET */
 	reg = cdns_ti_readl(data, USBSS_W1);
 	reg &= ~USBSS_W1_PWRUP_RST;
@@ -179,16 +172,10 @@  static int cdns_ti_probe(struct platform_device *pdev)
 	error = of_platform_populate(node, NULL, NULL, dev);
 	if (error) {
 		dev_err(dev, "failed to create children: %d\n", error);
-		goto err;
+		return error;
 	}
 
 	return 0;
-
-err:
-	pm_runtime_put_sync(data->dev);
-	pm_runtime_disable(data->dev);
-
-	return error;
 }
 
 static int cdns_ti_remove_core(struct device *dev, void *c)
@@ -205,8 +192,6 @@  static void cdns_ti_remove(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 
 	device_for_each_child(dev, NULL, cdns_ti_remove_core);
-	pm_runtime_put_sync(dev);
-	pm_runtime_disable(dev);
 
 	platform_set_drvdata(pdev, NULL);
 }