From: Basavaraj Natikar <bnatikar@amd.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Cc: gregkh@linuxfoundation.org, mathias.nyman@intel.com,
linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/2] USB: Extend pci resume function to handle PM events
Date: Wed, 19 Apr 2023 01:25:05 +0530 [thread overview]
Message-ID: <2116ba2b-b30a-67cb-364e-0931cff7f47c@amd.com> (raw)
In-Reply-To: <3f486c11-0824-451f-94d6-792f846889f1@rowland.harvard.edu>
On 4/18/2023 8:36 PM, Alan Stern wrote:
> On Tue, Apr 18, 2023 at 07:38:16PM +0530, Basavaraj Natikar wrote:
>> Currently, the pci_resume method has only a flag indicating whether the
>> system is resuming from hibernation. In order to handle all PM events like
>> AUTO_RESUME, SUSPEND etc change the pci_resume method to handle all PM
>> events.
> You might want to make a different kind of distinction between the
> various sorts of resume. For example, a resume from runtime suspend
> can occur either because of a request from the system (it needs to start
> using the device) or a remote wakeup request from an attached device.
> The different sorts of resume might have different requirements.
yes correct.
>
>> diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
>> index 4b148fe5e43b..1145c6e7fae5 100644
>> --- a/drivers/usb/host/ehci-pci.c
>> +++ b/drivers/usb/host/ehci-pci.c
>> @@ -354,10 +354,11 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
>> * Also they depend on separate root hub suspend/resume.
>> */
>>
>> -static int ehci_pci_resume(struct usb_hcd *hcd, bool hibernated)
>> +static int ehci_pci_resume(struct usb_hcd *hcd, int event)
>> {
>> struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>> struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
>> + bool hibernated = event == PM_EVENT_RESTORE;
> Please use the same indentation style as the surrounding code. Also,
> when a boolean expression is used in an assignment, I prefer to put it
> in parentheses to help set it off from the assignment operator:
>
> bool hibernated = (event == PM_EVENT_RESTORE);
Sure will change it accordingly.
>
>> diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
>> index 3592f757fe05..9b90c3221bd8 100644
>> --- a/drivers/usb/host/uhci-pci.c
>> +++ b/drivers/usb/host/uhci-pci.c
>> @@ -167,7 +167,7 @@ static void uhci_shutdown(struct pci_dev *pdev)
>>
>> #ifdef CONFIG_PM
>>
>> -static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated);
>> +static int uhci_resume(struct usb_hcd *hcd, bool hibernated);
> There's no need to change the function's name. After all, it is static.
sure will keep same function name.
>
>>
>> static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
>> {
>> @@ -202,13 +202,13 @@ static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
>>
>> /* Check for race with a wakeup request */
>> if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
>> - uhci_pci_resume(hcd, false);
>> + uhci_resume(hcd, false);
>> rc = -EBUSY;
>> }
>> return rc;
>> }
>>
>> -static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
>> +static int uhci_resume(struct usb_hcd *hcd, bool hibernated)
>> {
>> struct uhci_hcd *uhci = hcd_to_uhci(hcd);
>>
>> @@ -252,6 +252,10 @@ static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
>> return 0;
>> }
>>
>> +static int uhci_pci_resume(struct usb_hcd *hcd, int event)
>> +{
>> + return uhci_resume(hcd, event == PM_EVENT_RESTORE);
>> +}
> Again, try to avoid this wrapper.
Sure will avoid this change.
Thanks,
--
Basavaraj
>
> Alan Stern
next prev parent reply other threads:[~2023-04-18 19:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 14:08 [PATCH 0/2] Handle PM events for pci resume Basavaraj Natikar
2023-04-18 14:08 ` [PATCH 1/2] USB: Extend pci resume function to handle PM events Basavaraj Natikar
2023-04-18 15:06 ` Alan Stern
2023-04-18 19:55 ` Basavaraj Natikar [this message]
2023-04-18 15:23 ` Greg KH
2023-04-18 19:57 ` Basavaraj Natikar
2023-04-18 14:08 ` [PATCH 2/2] xhci: Improve the XHCI resume time Basavaraj Natikar
2023-04-18 15:25 ` Greg KH
2023-04-18 20:10 ` Basavaraj Natikar
2023-04-20 17:03 ` Mark Hasemeyer
2023-04-21 4:58 ` Basavaraj Natikar
2023-04-24 15:05 ` Mathias Nyman
2023-04-25 0:09 ` Wesley Cheng
2023-04-25 9:04 ` Mathias Nyman
2023-04-25 19:54 ` Wesley Cheng
2023-04-25 10:20 ` Basavaraj Natikar
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=2116ba2b-b30a-67cb-364e-0931cff7f47c@amd.com \
--to=bnatikar@amd.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--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