Re: [PATCH 2/2] mmc: sdhci-esdhc-imx: use pm_runtime_force_suspend() to optimize remove callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 May 2023 at 10:17, <haibo.chen@xxxxxxx> wrote:
>
> From: Haibo Chen <haibo.chen@xxxxxxx>
>
> Currently some code in sdhci_esdhc_imx_remove() duplicate with
> sdhci_esdhc_runtime_suspend(), so use pm_runtime_force_suspend()
> instead.

This is reasonable, but note that CONFIG_PM must always be set, as
that is needed to let pm_runtime_force_suspend() gate the clocks.

So, this boils down to whether there are cases when sdhci-esdhc-imx
can be built with CONFIG_PM unset?

Kind regards
Uffe

>
> Signed-off-by: Haibo Chen <haibo.chen@xxxxxxx>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 4cf42a028bb9..d7588faf52e0 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1805,23 +1805,16 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>  static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
>  {
>         struct sdhci_host *host = platform_get_drvdata(pdev);
> -       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -       struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
>         int dead;
>
>         pm_runtime_get_sync(&pdev->dev);
>         dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
> -       pm_runtime_disable(&pdev->dev);
> -       pm_runtime_put_noidle(&pdev->dev);
> -
>         sdhci_remove_host(host, dead);
> -
> -       clk_disable_unprepare(imx_data->clk_per);
> -       clk_disable_unprepare(imx_data->clk_ipg);
> -       clk_disable_unprepare(imx_data->clk_ahb);
> -
> -       if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
> -               cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
> +       device_set_wakeup_capable(&pdev->dev, false);
> +       pm_runtime_dont_use_autosuspend(&pdev->dev);
> +       pm_runtime_put_sync(&pdev->dev);
> +       /* Ensure device disabled */
> +       pm_runtime_force_suspend(&pdev->dev);
>
>         sdhci_pltfm_free(pdev);
>
> --
> 2.34.1
>



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux