public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: philipl@overt.org
Cc: "linux kernel" <linux-kernel@vger.kernel.org>,
	sdhci-devel@list.drzeus.cx, sfr@canb.auug.org.au,
	"Pierre Ossman" <drzeus@drzeus.cx>
Subject: Re: [PATCH] ricoh_mmc: Use suspend/resume_noirq (v2) (resend)
Date: Thu, 8 Jan 2009 23:14:52 +0100	[thread overview]
Message-ID: <200901082314.52840.rjw@sisk.pl> (raw)
In-Reply-To: <40499.98.210.152.237.1231345314.squirrel@overt.org>

On Wednesday 07 January 2009, philipl@overt.org wrote:
> If ricoh_mmc suspends before sdhci_pci, it will pull the card
> out from under the controller, which could leave the system in
> a very confused state.

Does it really happen?  That depends on which of them is registered first.

> Using suspend/resume_noirq ensures that sdhci_pci suspends first
> and resumes second.

Well, I'm not sure if this is the best approach, but I don't know what the
dependencies between the devices are, so can you please explain that
to me?

That said, if you want to suspend-resume ricoh_mmc with interrupts disabled,
please use the legacy PCI .suspend_late() and .resume_early() callbacks for
that, since in the new framework the core will carry out some standard PM
operations in addition to your .suspend_noirq() and .resume_noirq().  It may
not be what you want in this case, though.

Thanks,
Rafael


> Signed-off-by: Philip Langdale <philipl@overt.org>
> Acked-by: Pierre Ossman <drzeus@drzeus.cx>
> ---
> 
>   ricoh_mmc.c |   20 ++++++++++++++++----
>   1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/ricoh_mmc.c b/drivers/mmc/host/ricoh_mmc.c
> index 1837719..b4958a7 100644
> --- a/drivers/mmc/host/ricoh_mmc.c
> +++ b/drivers/mmc/host/ricoh_mmc.c
> @@ -194,10 +194,14 @@ static void __devexit ricoh_mmc_remove(struct pci_dev *pdev)
>  	pci_set_drvdata(pdev, NULL);
>  }
> 
> -static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state) +static int
> ricoh_mmc_suspend_noirq(struct device *dev)
>  {
> +	struct pci_dev *pdev = NULL;
>  	struct pci_dev *fw_dev = NULL;
> 
> +	pdev = to_pci_dev(dev);
> +	BUG_ON(pdev == NULL);
> +
>  	fw_dev = pci_get_drvdata(pdev);
>  	BUG_ON(fw_dev == NULL);
> 
> @@ -208,10 +212,14 @@ static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state)
>  	return 0;
>  }
> 
> -static int ricoh_mmc_resume(struct pci_dev *pdev)
> +static int ricoh_mmc_resume_noirq(struct device *dev)
>  {
> +	struct pci_dev *pdev = NULL;
>  	struct pci_dev *fw_dev = NULL;
> 
> +	pdev = to_pci_dev(dev);
> +	BUG_ON(pdev == NULL);
> +
>  	fw_dev = pci_get_drvdata(pdev);
>  	BUG_ON(fw_dev == NULL);
> 
> @@ -222,13 +230,17 @@ static int ricoh_mmc_resume(struct pci_dev *pdev)
>  	return 0;
>  }
> 
> +static struct dev_pm_ops ricoh_mmc_pm_opts = {
> +	.suspend_noirq =	ricoh_mmc_suspend_noirq,
> +	.resume_noirq =		ricoh_mmc_resume_noirq,
> +};
> +
>  static struct pci_driver ricoh_mmc_driver = {
>  	.name = 	DRIVER_NAME,
>  	.id_table =	pci_ids,
>  	.probe = 	ricoh_mmc_probe,
>  	.remove =	__devexit_p(ricoh_mmc_remove),
> -	.suspend =	ricoh_mmc_suspend,
> -	.resume =	ricoh_mmc_resume,
> +	.driver.pm =	&ricoh_mmc_pm_opts,
>  };
> 
>  /*****************************************************************************\
> 
> Rafael,
> 
> Pierre asked that you take this patch into your tree because it depends on
> the new pm ops design.

  parent reply	other threads:[~2009-01-08 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 16:21 [PATCH] ricoh_mmc: Use suspend/resume_noirq (v2) (resend) philipl
2009-01-07 22:33 ` Rafael J. Wysocki
2009-01-08 22:14 ` Rafael J. Wysocki [this message]
2009-01-10  2:31   ` Philip Langdale
2009-01-10 12:32     ` Rafael J. Wysocki
2009-01-12 15:14     ` Pierre Ossman

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=200901082314.52840.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=drzeus@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipl@overt.org \
    --cc=sdhci-devel@list.drzeus.cx \
    --cc=sfr@canb.auug.org.au \
    /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