* [PATCH] mmc: sdhci-of-aspeed: depopulate slots before disabling clock
@ 2026-06-16 0:49 Pengpeng Hou
2026-06-16 6:13 ` Adrian Hunter
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-16 0:49 UTC (permalink / raw)
To: Adrian Hunter, Andrew Jeffery, Ulf Hansson, Joel Stanley,
linux-mmc, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel
Cc: Pengpeng Hou
aspeed_sdc_probe() creates child slot devices one by one after enabling
the controller clock. If a later slot creation fails, the already-created
slot devices remain registered while the parent probe returns an error.
Depopulate any created slot devices on probe failure and during remove,
before disabling the shared controller clock used by the slots.
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/mmc/host/sdhci-of-aspeed.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index f5d973783cbe..3e941b176687 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -560,12 +560,14 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
cpdev = of_platform_device_create(child, NULL, &pdev->dev);
if (!cpdev) {
ret = -ENODEV;
- goto err_clk;
+ goto err_depopulate;
}
}
return 0;
+err_depopulate:
+ of_platform_depopulate(&pdev->dev);
err_clk:
clk_disable_unprepare(sdc->clk);
return ret;
@@ -575,6 +577,7 @@ static void aspeed_sdc_remove(struct platform_device *pdev)
{
struct aspeed_sdc *sdc = dev_get_drvdata(&pdev->dev);
+ of_platform_depopulate(&pdev->dev);
clk_disable_unprepare(sdc->clk);
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mmc: sdhci-of-aspeed: depopulate slots before disabling clock
2026-06-16 0:49 [PATCH] mmc: sdhci-of-aspeed: depopulate slots before disabling clock Pengpeng Hou
@ 2026-06-16 6:13 ` Adrian Hunter
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2026-06-16 6:13 UTC (permalink / raw)
To: Pengpeng Hou, Andrew Jeffery, Ulf Hansson, Joel Stanley,
linux-mmc, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel,
Ryan Chen
On 16/06/2026 03:49, Pengpeng Hou wrote:
> aspeed_sdc_probe() creates child slot devices one by one after enabling
> the controller clock. If a later slot creation fails, the already-created
> slot devices remain registered while the parent probe returns an error.
>
> Depopulate any created slot devices on probe failure and during remove,
> before disabling the shared controller clock used by the slots.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/mmc/host/sdhci-of-aspeed.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index f5d973783cbe..3e941b176687 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -560,12 +560,14 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
> cpdev = of_platform_device_create(child, NULL, &pdev->dev);
> if (!cpdev) {
> ret = -ENODEV;
> - goto err_clk;
> + goto err_depopulate;
> }
> }
>
> return 0;
>
> +err_depopulate:
> + of_platform_depopulate(&pdev->dev);
of_platform_depopulate() does not appear to work with
of_platform_device_create() due to the OF_POPULATED_BUS flag
> err_clk:
> clk_disable_unprepare(sdc->clk);
> return ret;
> @@ -575,6 +577,7 @@ static void aspeed_sdc_remove(struct platform_device *pdev)
> {
> struct aspeed_sdc *sdc = dev_get_drvdata(&pdev->dev);
>
> + of_platform_depopulate(&pdev->dev);
> clk_disable_unprepare(sdc->clk);
> }
>
There is another existing issue that Sashiko noticed:
struct platform_driver aspeed_sdc_driver has:
.pm = &sdhci_pltfm_pmops,
where it won't work correctly. It looks like it
should have instead been in:
struct platform_driver aspeed_sdhci_driver
Refer:
https://sashiko.dev/#/patchset/20260616004953.3469-1-pengpeng%40iscas.ac.cn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-16 6:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16 0:49 [PATCH] mmc: sdhci-of-aspeed: depopulate slots before disabling clock Pengpeng Hou
2026-06-16 6:13 ` Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox