diff mbox series

usb: dwc3: exynos: Fix remove() function

Message ID 20221108214249.32528-1-m.szyprowski@samsung.com
State Superseded
Headers show
Series usb: dwc3: exynos: Fix remove() function | expand

Commit Message

Marek Szyprowski Nov. 8, 2022, 9:42 p.m. UTC
The core DWC3 device node was not properly removed by the custom
dwc3_exynos_remove_child() function. Replace it with generic
of_platform_depopulate() which does that job right.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/dwc3/dwc3-exynos.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Thinh Nguyen Nov. 9, 2022, 12:33 a.m. UTC | #1
On Tue, Nov 08, 2022, Marek Szyprowski wrote:
> The core DWC3 device node was not properly removed by the custom
> dwc3_exynos_remove_child() function. Replace it with generic
> of_platform_depopulate() which does that job right.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/usb/dwc3/dwc3-exynos.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index 0ecf20eeceee..4be6a873bd07 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -37,15 +37,6 @@ struct dwc3_exynos {
>  	struct regulator	*vdd10;
>  };
>  
> -static int dwc3_exynos_remove_child(struct device *dev, void *unused)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -
> -	platform_device_unregister(pdev);
> -
> -	return 0;
> -}
> -
>  static int dwc3_exynos_probe(struct platform_device *pdev)
>  {
>  	struct dwc3_exynos	*exynos;
> @@ -142,7 +133,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
>  	struct dwc3_exynos	*exynos = platform_get_drvdata(pdev);
>  	int i;
>  
> -	device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child);
> +	of_platform_depopulate(&pdev->dev);
>  
>  	for (i = exynos->num_clks - 1; i >= 0; i--)
>  		clk_disable_unprepare(exynos->clks[i]);
> -- 
> 2.17.1
> 

Can you add Fixes tag and possibly Cc stable?

After adding the tags, you can add my Ack:
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index 0ecf20eeceee..4be6a873bd07 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -37,15 +37,6 @@  struct dwc3_exynos {
 	struct regulator	*vdd10;
 };
 
-static int dwc3_exynos_remove_child(struct device *dev, void *unused)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-
-	platform_device_unregister(pdev);
-
-	return 0;
-}
-
 static int dwc3_exynos_probe(struct platform_device *pdev)
 {
 	struct dwc3_exynos	*exynos;
@@ -142,7 +133,7 @@  static int dwc3_exynos_remove(struct platform_device *pdev)
 	struct dwc3_exynos	*exynos = platform_get_drvdata(pdev);
 	int i;
 
-	device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child);
+	of_platform_depopulate(&pdev->dev);
 
 	for (i = exynos->num_clks - 1; i >= 0; i--)
 		clk_disable_unprepare(exynos->clks[i]);