diff mbox series

[v3] mmc: sdhci-of-arasan: Add shutdown callback

Message ID 20250612054136.5860-1-alvin.paulp@amd.com
State New
Headers show
Series [v3] mmc: sdhci-of-arasan: Add shutdown callback | expand

Commit Message

Paul Alvin June 12, 2025, 5:41 a.m. UTC
Implement shutdown hook to ensure proper host shutdown by using sdhci
platform suspend. This ensure a safe transition when the Kexec utility
calls the shutdown hook, facilitating seamless loading and booting of
a new kernel from the currently running one.

Signed-off-by: Paul Alvin <alvin.paulp@amd.com>
---

Changes in v3:
- Updated commit description.

Changes in v2:
- Make use of platform suspend instead of driver suspend as driver
  suspend will only get defined if PMC_SLEEP is configured which
  results in build failure if it is not configured.
- Updated commit description.

 drivers/mmc/host/sdhci-of-arasan.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Adrian Hunter June 16, 2025, 11:34 a.m. UTC | #1
On 12/06/2025 08:41, Paul Alvin wrote:
> Implement shutdown hook to ensure proper host shutdown by using sdhci
> platform suspend. This ensure a safe transition when the Kexec utility
> calls the shutdown hook, facilitating seamless loading and booting of
> a new kernel from the currently running one.

Still sounds a bit unnecessary.  What happens if this is not done?

> 
> Signed-off-by: Paul Alvin <alvin.paulp@amd.com>
> ---
> 
> Changes in v3:
> - Updated commit description.
> 
> Changes in v2:
> - Make use of platform suspend instead of driver suspend as driver
>   suspend will only get defined if PMC_SLEEP is configured which
>   results in build failure if it is not configured.
> - Updated commit description.
> 
>  drivers/mmc/host/sdhci-of-arasan.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 8c29676ab662..4abdad3c4e5b 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -2056,6 +2056,11 @@ static void sdhci_arasan_remove(struct platform_device *pdev)
>  	clk_disable_unprepare(clk_ahb);
>  }
>  
> +static void sdhci_arasan_shutdown(struct platform_device *pdev)
> +{
> +	sdhci_pltfm_suspend(&pdev->dev);
> +}
> +
>  static struct platform_driver sdhci_arasan_driver = {
>  	.driver = {
>  		.name = "sdhci-arasan",
> @@ -2065,6 +2070,7 @@ static struct platform_driver sdhci_arasan_driver = {
>  	},
>  	.probe = sdhci_arasan_probe,
>  	.remove = sdhci_arasan_remove,
> +	.shutdown = sdhci_arasan_shutdown,
>  };
>  
>  module_platform_driver(sdhci_arasan_driver);
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 8c29676ab662..4abdad3c4e5b 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -2056,6 +2056,11 @@  static void sdhci_arasan_remove(struct platform_device *pdev)
 	clk_disable_unprepare(clk_ahb);
 }
 
+static void sdhci_arasan_shutdown(struct platform_device *pdev)
+{
+	sdhci_pltfm_suspend(&pdev->dev);
+}
+
 static struct platform_driver sdhci_arasan_driver = {
 	.driver = {
 		.name = "sdhci-arasan",
@@ -2065,6 +2070,7 @@  static struct platform_driver sdhci_arasan_driver = {
 	},
 	.probe = sdhci_arasan_probe,
 	.remove = sdhci_arasan_remove,
+	.shutdown = sdhci_arasan_shutdown,
 };
 
 module_platform_driver(sdhci_arasan_driver);