All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-omap: Fix a lockdep warning for PM runtime init
@ 2022-06-17  4:03 Tony Lindgren
  2022-06-17  6:25 ` Adrian Hunter
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2022-06-17  4:03 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Chunyan Zhang, Faiz Abbas, Kishon Vijay Abraham I,
	Santosh Shilimkar, linux-mmc, linux-omap, Yegor Yefremov,
	Arnd Bergmann

We need hardware enabled early in probe to detect capabilities, but must
not call sdhci_runtime_resume_host() until sdhci_setup_host() has been
called. Let's check for an initialized controller like we already do
for context restore.

Fixes: f433e8aac6b9 ("mmc: sdhci-omap: Implement PM runtime functions")
Reported-by: Yegor Yefremov <yegorslists@googlemail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/sdhci-omap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1441,7 +1441,8 @@ static int __maybe_unused sdhci_omap_runtime_suspend(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
 
-	sdhci_runtime_suspend_host(host);
+	if (omap_host->con != -EINVAL)
+		sdhci_runtime_suspend_host(host);
 
 	sdhci_omap_context_save(omap_host);
 
@@ -1458,10 +1459,10 @@ static int __maybe_unused sdhci_omap_runtime_resume(struct device *dev)
 
 	pinctrl_pm_select_default_state(dev);
 
-	if (omap_host->con != -EINVAL)
+	if (omap_host->con != -EINVAL) {
 		sdhci_omap_context_restore(omap_host);
-
-	sdhci_runtime_resume_host(host, 0);
+		sdhci_runtime_resume_host(host, 0);
+	}
 
 	return 0;
 }
-- 
2.36.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-omap: Fix a lockdep warning for PM runtime init
  2022-06-17  4:03 [PATCH] mmc: sdhci-omap: Fix a lockdep warning for PM runtime init Tony Lindgren
@ 2022-06-17  6:25 ` Adrian Hunter
  2022-06-22  5:09   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2022-06-17  6:25 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Adrian Hunter, Chunyan Zhang, Faiz Abbas, Kishon Vijay Abraham I,
	Santosh Shilimkar, linux-mmc, linux-omap, Yegor Yefremov,
	Arnd Bergmann

On 17/06/22 07:03, Tony Lindgren wrote:
> We need hardware enabled early in probe to detect capabilities, but must
> not call sdhci_runtime_resume_host() until sdhci_setup_host() has been
> called. Let's check for an initialized controller like we already do
> for context restore.

Begs the question: why not prevent runtime pm until after sdhci_setup_host().
Maybe expand the commit message explanation a bit?

> 
> Fixes: f433e8aac6b9 ("mmc: sdhci-omap: Implement PM runtime functions")
> Reported-by: Yegor Yefremov <yegorslists@googlemail.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/mmc/host/sdhci-omap.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
> --- a/drivers/mmc/host/sdhci-omap.c
> +++ b/drivers/mmc/host/sdhci-omap.c
> @@ -1441,7 +1441,8 @@ static int __maybe_unused sdhci_omap_runtime_suspend(struct device *dev)
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
>  
> -	sdhci_runtime_suspend_host(host);
> +	if (omap_host->con != -EINVAL)
> +		sdhci_runtime_suspend_host(host);
>  
>  	sdhci_omap_context_save(omap_host);
>  
> @@ -1458,10 +1459,10 @@ static int __maybe_unused sdhci_omap_runtime_resume(struct device *dev)
>  
>  	pinctrl_pm_select_default_state(dev);
>  
> -	if (omap_host->con != -EINVAL)
> +	if (omap_host->con != -EINVAL) {
>  		sdhci_omap_context_restore(omap_host);
> -
> -	sdhci_runtime_resume_host(host, 0);
> +		sdhci_runtime_resume_host(host, 0);
> +	}
>  
>  	return 0;
>  }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-omap: Fix a lockdep warning for PM runtime init
  2022-06-17  6:25 ` Adrian Hunter
@ 2022-06-22  5:09   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2022-06-22  5:09 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Chunyan Zhang, Faiz Abbas, Kishon Vijay Abraham I,
	Santosh Shilimkar, linux-mmc, linux-omap, Yegor Yefremov,
	Arnd Bergmann

* Adrian Hunter <adrian.hunter@intel.com> [220617 06:20]:
> On 17/06/22 07:03, Tony Lindgren wrote:
> > We need hardware enabled early in probe to detect capabilities, but must
> > not call sdhci_runtime_resume_host() until sdhci_setup_host() has been
> > called. Let's check for an initialized controller like we already do
> > for context restore.
> 
> Begs the question: why not prevent runtime pm until after sdhci_setup_host().
> Maybe expand the commit message explanation a bit?

Sure will add some comments for why sdhci_omap_set_capabilities() is needed
before sdhci_setup_host() and post v2.

Thanks,

Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-22  5:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17  4:03 [PATCH] mmc: sdhci-omap: Fix a lockdep warning for PM runtime init Tony Lindgren
2022-06-17  6:25 ` Adrian Hunter
2022-06-22  5:09   ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.