From: Adrian Hunter <adrian.hunter@intel.com>
To: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH] mmc: sdhci-pci: move suspend/resume hooks to dev_pm_ops
Date: Wed, 02 Nov 2011 12:09:12 +0200 [thread overview]
Message-ID: <4EB116C8.3060207@intel.com> (raw)
In-Reply-To: <4EB11137.4090404@intel.com>
On 02/11/11 11:45, Adrian Hunter wrote:
> On 01/11/11 14:34, Manuel Lauss wrote:
>> Move suspend/resume/freeze/thaw hooks from struct pci_driver to dev_pm_ops,
>> mainly to shut up the driver cores' complaints about this driver using
>> both new and legacy PM methods.
>
> Thanks for picking up on this
Also use to_pci_dev(dev) instead of container_of(dev, struct pci_dev, dev)
>
>>
>> Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
>> ---
>> I've only tested suspend to ram, but it works.
>>
>> drivers/mmc/host/sdhci-pci.c | 24 ++++++++++++++++++++----
>> 1 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
>> index d833d9c..53bfbe7 100644
>> --- a/drivers/mmc/host/sdhci-pci.c
>> +++ b/drivers/mmc/host/sdhci-pci.c
>> @@ -993,7 +993,7 @@ static struct sdhci_ops sdhci_pci_ops = {
>>
>> #ifdef CONFIG_PM
>>
>> -static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state)
>> +static int sdhci_pci_do_suspend(struct pci_dev *pdev, pm_message_t state)
>> {
>> struct sdhci_pci_chip *chip;
>> struct sdhci_pci_slot *slot;
>> @@ -1050,8 +1050,9 @@ static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state)
>> return 0;
>> }
>>
>> -static int sdhci_pci_resume(struct pci_dev *pdev)
>> +static int sdhci_pci_resume(struct device *dev)
>> {
>> + struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
>> struct sdhci_pci_chip *chip;
>> struct sdhci_pci_slot *slot;
>> int i, ret;
>> @@ -1085,9 +1086,22 @@ static int sdhci_pci_resume(struct pci_dev *pdev)
>> return 0;
>> }
>>
>> +static int sdhci_pci_suspend(struct device *dev)
>> +{
>> + struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
>> + return sdhci_pci_do_suspend(pdev, PMSG_SUSPEND);
>
> We need to get rid of state entirely. Unfortunately that means
> changing sdhci_suspend_host() and all callers
>
>> +}
>> +
>> +static int sdhci_pci_freeze(struct device *dev)
>> +{
>> + struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
>> + return sdhci_pci_do_suspend(pdev, PMSG_FREEZE);
>> +}
>> +
>> #else /* CONFIG_PM */
>>
>> #define sdhci_pci_suspend NULL
>> +#define sdhci_pci_freeze NULL
>> #define sdhci_pci_resume NULL
>>
>> #endif /* CONFIG_PM */
>> @@ -1176,6 +1190,10 @@ static int sdhci_pci_runtime_idle(struct device *dev)
>> #endif
>>
>> static const struct dev_pm_ops sdhci_pci_pm_ops = {
>> + .suspend = sdhci_pci_suspend,
>> + .freeze = sdhci_pci_freeze,
>> + .resume = sdhci_pci_resume,
>> + .thaw = sdhci_pci_resume,
>
> freeze and thaw are not needed
>
>> .runtime_suspend = sdhci_pci_runtime_suspend,
>> .runtime_resume = sdhci_pci_runtime_resume,
>> .runtime_idle = sdhci_pci_runtime_idle,
>> @@ -1428,8 +1446,6 @@ static struct pci_driver sdhci_driver = {
>> .id_table = pci_ids,
>> .probe = sdhci_pci_probe,
>> .remove = __devexit_p(sdhci_pci_remove),
>> - .suspend = sdhci_pci_suspend,
>> - .resume = sdhci_pci_resume,
>> .driver = {
>> .pm = &sdhci_pci_pm_ops
>> },
>
>
next prev parent reply other threads:[~2011-11-02 10:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 12:34 [PATCH] mmc: sdhci-pci: move suspend/resume hooks to dev_pm_ops Manuel Lauss
2011-11-02 9:45 ` Adrian Hunter
2011-11-02 10:09 ` Adrian Hunter [this message]
2011-11-02 11:12 ` Manuel Lauss
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=4EB116C8.3060207@intel.com \
--to=adrian.hunter@intel.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=manuel.lauss@googlemail.com \
/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 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.