usb: cdns3: imx: improve driver .remove API
authorPeter Chen <peter.chen@nxp.com>
Thu, 10 Dec 2020 13:33:21 +0000 (21:33 +0800)
committerPeter Chen <peter.chen@nxp.com>
Tue, 29 Dec 2020 05:39:53 +0000 (13:39 +0800)
Keep the runtime active during the remove operation, and disable
related clocks.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/cdns3/cdns3-imx.c

index 6b358e8be5799a832183bf56ad5289f5196c4d15..7990fee03fe4bb03f102a0cdb550771131e75be4 100644 (file)
@@ -221,8 +221,13 @@ err:
 static int cdns_imx_remove(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
+       struct cdns_imx *data = dev_get_drvdata(dev);
 
+       pm_runtime_get_sync(dev);
        of_platform_depopulate(dev);
+       clk_bulk_disable_unprepare(data->num_clks, data->clks);
+       pm_runtime_disable(dev);
+       pm_runtime_put_noidle(dev);
        platform_set_drvdata(pdev, NULL);
 
        return 0;