linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: linux-pm@lists.linux-foundation.org, Chris Ball <cjb@laptop.org>,
	linux-mmc@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: Recent "Run the driver callback directly" patch breaks libertas suspend
Date: Mon, 26 Mar 2012 08:45:15 +1100	[thread overview]
Message-ID: <20120326084515.0fd3ee7f@notabene.brown> (raw)
In-Reply-To: <201203252325.37478.rjw@sisk.pl>


[-- Attachment #1.1: Type: text/plain, Size: 3671 bytes --]

On Sun, 25 Mar 2012 23:25:37 +0200 "Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> On Sunday, March 25, 2012, Rafael J. Wysocki wrote:
> > Hi,
> > 
> > On Sunday, March 25, 2012, NeilBrown wrote:
> > > 
> > > Hi Rafael,
> > > 
> > >  Your recent patch:
> > >    commit 35cd133c
> > >    PM: Run the driver callback directly if the subsystem one is not there
> > > 
> > >  breaks suspend for my libertas wifi and probably other SDIO devices.
> > 
> > Well, the patch is not recent.  The _commit_ is more than three months old
> > and the patch has been around since the last November (at least).
> > 
> > >  SDIO (and possible MMC in general) has a protocol where the suspend
> > >  method can return -ENOSYS and this means "There is no point in suspending,
> > >  just turn me off".
> > >
> > >  The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend'
> > >  function so the new code call the device's suspend function which returns
> > >  ENOSYS and the suspend fails.
> > > 
> > >  The previous code ignores the device as there is no bus suspend, and when it
> > >  gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the
> > >  device suspend function catches the ENOSYS, and turns it off.
> > 
> > Well, I can only call that a blatant abuse of the PM infrastructure.
> > 
> > >  I suspect just reverting it isn't the right long term solution, however I
> > >  can confirm that it works for me for now.
> > 
> > It's not a solution at all, because there's code that depends on it already in
> > the tree and the fact that it works for you doesn't mean it won't break other
> > systems.  So no, it's not an option.
> > 
> > >  I'm happy to try any alternate fixes you would like to suggest (but I cannot
> > >  promise how quickly I will get the testing done).
> > > 
> > >  (I'm testing with 3.3)
> > 
> > The only fix I can think of is to rework SDIO to stop abusing the PM callbacks.
> > I'll have a look at that next week, although I can't promise anything any time
> > soon, because I'm heading to San Francisco on Saturday.
> 
> Well, this is kind of a long shot, but I wonder if the patch below makes
> any difference?

Hi Rafael,
 thanks for looking into this so quickly.

I removed the revert and applied this patch instead and can confirm that
suspend completes now (and resume works and the wifi works after resume).

Further, this patch fits with my (fairly shallow) understanding of the
problem.

Thanks!

NeilBrown

> 
> Rafael
> 
> ---
>  drivers/mmc/core/sdio_bus.c |   12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> Index: linux/drivers/mmc/core/sdio_bus.c
> ===================================================================
> --- linux.orig/drivers/mmc/core/sdio_bus.c
> +++ linux/drivers/mmc/core/sdio_bus.c
> @@ -192,9 +192,15 @@ static int sdio_bus_remove(struct device
>  	return ret;
>  }
>  
> -#ifdef CONFIG_PM_RUNTIME
> +#ifdef CONFIG_PM
> +
> +static int pm_no_operation(struct device *dev)
> +{
> +	return 0;
> +}
>  
>  static const struct dev_pm_ops sdio_bus_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation)
>  	SET_RUNTIME_PM_OPS(
>  		pm_generic_runtime_suspend,
>  		pm_generic_runtime_resume,
> @@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_
>  
>  #define SDIO_PM_OPS_PTR	(&sdio_bus_pm_ops)
>  
> -#else /* !CONFIG_PM_RUNTIME */
> +#else /* !CONFIG_PM */
>  
>  #define SDIO_PM_OPS_PTR	NULL
>  
> -#endif /* !CONFIG_PM_RUNTIME */
> +#endif /* !CONFIG_PM */
>  
>  static struct bus_type sdio_bus_type = {
>  	.name		= "sdio",


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2012-03-25 21:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25  9:38 Recent "Run the driver callback directly" patch breaks libertas suspend NeilBrown
2012-03-25 15:18 ` [linux-pm] " Alan Stern
2012-03-25 21:10   ` Rafael J. Wysocki
2012-03-25 21:09 ` Rafael J. Wysocki
2012-03-25 21:25   ` Rafael J. Wysocki
2012-03-25 21:45     ` NeilBrown [this message]
     [not found]       ` <201203260029.24826.rjw@sisk.pl>
2012-12-02  8:46         ` [PATCH] PM / SDIO: Use empty system suspend/resume callbacks at the bus level (was: Re: Recent ...) NeilBrown
2012-12-02 13:48           ` [PATCH] SDIO / PM: Add empty bus-level suspend/resume callbacks Rafael J. Wysocki
2012-12-02 19:54             ` NeilBrown
2012-12-02 21:49               ` Chris Ball
2012-12-02 21:01             ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120326084515.0fd3ee7f@notabene.brown \
    --to=neilb@suse.de \
    --cc=cjb@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).