From: Shaohua Li <shaohua.li@intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>,
"david-b@pacbell.net" <david-b@pacbell.net>,
"dbrownell@users.sourceforge.net"
<dbrownell@users.sourceforge.net>
Subject: Re: [RFC 3/5] pci wakeup handler
Date: Wed, 22 Oct 2008 13:34:44 +0800 [thread overview]
Message-ID: <20081022053444.GC15271@sli10-desk.sh.intel.com> (raw)
In-Reply-To: <200810192150.41305.rjw@sisk.pl>
On Mon, Oct 20, 2008 at 03:50:40AM +0800, Rafael J. Wysocki wrote:
> On Thursday, 11 of September 2008, Shaohua Li wrote:
> > pci subsystem wakeup handler.
>
> Perhaps add a bit more explanation here - what is introduced, why and why this
> particular way.
I'll add a kernel doc in later post.
> > +static bool pci_handle_one_wakeup_event(struct pci_dev *pdev)
> > +{
>
> I don't really like that being a boolean function. I'd make it return 0 on
> success and error code on failure.
Oh, in my previous post, somebody like a boolean and then you like an int
in the mail list. Either is ok to me, but I'd like to have a reason
instead of a 'like' or 'unlike'.
> > + /* clear PME status and disable PME to avoid interrupt flood */
> > + pci_read_config_word(pdev, pme_pos + PCI_PM_CTRL, &pmcsr);
> > + if (!(pmcsr & PCI_PM_CTRL_PME_STATUS))
> > + return false;
> > + /* I see spurious PME here, just ignore it for now */
> > + if (!(pmcsr & PCI_PM_CTRL_PME_ENABLE))
> > + spurious = true;
> > + else
> > + pmcsr &= ~PCI_PM_CTRL_PME_ENABLE;
>
> If you do this unconditionally, you'll be able to use pci_pme_active() for it.
> Actually, you can use pci_pme_enabled() for checking if PME is enabled
> and pci_pme_status() for checking if the PME status is set. Then,
> you can remove the reference to the config space from here and use
> those low-level callbacks instead of them.
ok.
> > + pmcsr |= PCI_PM_CTRL_PME_STATUS;
> > + pci_write_config_word(pdev, pme_pos + PCI_PM_CTRL, pmcsr);
> > +
> > + if (spurious)
> > + return false;
> > + return true;
> > +out:
> > + if (drv && drv->pm && drv->pm->base.wakeup_event)
> > + return drv->pm->base.wakeup_event(&pdev->dev);
>
> I'd move this into the 'if (!pme_pos)' block. And is this what we want really?
> In this case the driver's wakeup_event() will be responsible for checking
> if the wake-up event is valid etc.
Yes, device driver should check if a wake-up event is valid.
> > + device_receive_wakeup_event(&target->dev);
>
> Why do we use device_receive_wakeup_event() here?
the device receives wakeup event, so it should do something.
>
> > + return ret;
> > + }
> > +
> > + if (ret)
> > + device_receive_wakeup_event(&target->dev);
>
> And here? What's the idea?
ditto
> > + device_receive_wakeup_event(&tmp->dev);
>
> What exactly is the role of device_receive_wakeup_event() here?
ditto
> > + }
> > + }
> > + }
> > + return ret;
> > +}
> > +EXPORT_SYMBOL(pci_handle_wakeup_event);
> > +
> > +static bool pci_pm_wakeup_event(struct device *dev)
> > +{
> > + return pci_handle_wakeup_event(to_pci_dev(dev));
> > +}
>
> What exactly is the point of introducing this function?
David said other archs (embedded system) might require it.
Thanks,
Shaohua
next prev parent reply other threads:[~2008-10-22 5:34 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-11 6:30 [RFC 0/5] device wakeup event support v2 Shaohua Li
2008-09-11 6:30 ` [RFC 1/5] devcore introduce wakeup_event callback Shaohua Li
2008-10-19 19:04 ` Rafael J. Wysocki
2008-10-19 19:42 ` Rafael J. Wysocki
2008-10-22 5:23 ` Shaohua Li
2008-09-11 6:30 ` [RFC 2/5] devcore adds generic wakeup event handler Shaohua Li
2008-09-11 18:48 ` Bjorn Helgaas
2008-10-19 19:06 ` Rafael J. Wysocki
2008-10-22 5:24 ` Shaohua Li
2008-10-22 11:57 ` Rafael J. Wysocki
2008-09-11 6:30 ` [RFC 3/5] pci wakeup handler Shaohua Li
2008-10-19 19:50 ` Rafael J. Wysocki
2008-10-22 5:34 ` Shaohua Li [this message]
2008-10-22 12:01 ` Rafael J. Wysocki
2008-09-11 6:30 ` [RFC 4/5] PCIe native PME detection Shaohua Li
2008-10-19 20:30 ` Rafael J. Wysocki
2008-10-22 5:49 ` Shaohua Li
2008-10-22 12:08 ` Rafael J. Wysocki
2008-09-11 6:30 ` [RFC 5/5] ACPI GPE based wakeup event detection Shaohua Li
2008-10-19 20:39 ` Rafael J. Wysocki
2008-10-22 6:51 ` Shaohua Li
2008-10-22 12:12 ` Rafael J. Wysocki
2008-09-14 23:50 ` [RFC 0/5] device wakeup event support v2 Rafael J. Wysocki
2008-10-06 1:57 ` Shaohua Li
-- strict thread matches above, loose matches on Subject: below --
2008-09-08 9:19 [RFC 0/5] device wakeup event support shaohua.li
2008-09-08 9:19 ` [RFC 3/5] pci wakeup handler shaohua.li
2008-09-08 13:09 ` Rafael J. Wysocki
2008-09-09 1:44 ` Li, Shaohua
2008-09-09 2:56 ` David Brownell
2008-09-09 3:38 ` Li, Shaohua
2008-09-09 2:56 ` David Brownell
2008-09-09 3:33 ` Li, Shaohua
2008-09-09 4:04 ` David Brownell
2008-09-09 11:09 ` Rafael J. Wysocki
2008-09-09 16:18 ` David Brownell
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=20081022053444.GC15271@sli10-desk.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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