All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lu, Baolu" <baolu.lu@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] usb: xhci: implement device_suspend/device_resume entries
Date: Fri, 08 May 2015 15:46:20 +0800	[thread overview]
Message-ID: <554C69CC.4030104@linux.intel.com> (raw)
In-Reply-To: <20150508072821.GA18627@kroah.com>



On 05/08/2015 03:28 PM, Greg Kroah-Hartman wrote:
> On Fri, May 08, 2015 at 09:23:40AM +0800, Lu, Baolu wrote:
>>
>> On 05/08/2015 04:47 AM, Greg Kroah-Hartman wrote:
>>> On Thu, May 07, 2015 at 10:18:15AM +0800, Lu Baolu wrote:
>>>> This patch implements device_suspend/device_resume entries for xHC driver.
>>>> device_suspend will be called when a USB device is about to suspend. It
>>>> will issue a stop endpoint command for each endpoint in this device. The
>>>> Suspend(SP) bit in the command TRB will set which will give xHC a hint
>>>> about the suspend. device_resume will be called when a USB device is just
>>>> resumed. It will ring doorbells of all endpoint unconditionally. XHC may
>>>> use these suspend/resume hints to optimize its operation.
>>>>
>>>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>>>> ---
>>>>   drivers/usb/host/xhci-hub.c |  2 +-
>>>>   drivers/usb/host/xhci.c     | 40 ++++++++++++++++++++++++++++++++++++++++
>>>>   drivers/usb/host/xhci.h     | 11 +++++++++++
>>>>   3 files changed, 52 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>>>> index 0827d7c..a83e82e 100644
>>>> --- a/drivers/usb/host/xhci-hub.c
>>>> +++ b/drivers/usb/host/xhci-hub.c
>>>> @@ -266,7 +266,7 @@ int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
>>>>    * to complete.
>>>>    * suspend will set to 1, if suspend bit need to set in command.
>>>>    */
>>>> -static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
>>>> +int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
>>>>   {
>>>>   	struct xhci_virt_device *virt_dev;
>>>>   	struct xhci_command *cmd;
>>>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>>>> index ec8ac16..6b61833 100644
>>>> --- a/drivers/usb/host/xhci.c
>>>> +++ b/drivers/usb/host/xhci.c
>>>> @@ -4680,6 +4680,40 @@ int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd,
>>>>   		return ret;
>>>>   	return 0;
>>>>   }
>>>> +
>>>> +/*
>>>> + * xHCI compatible host controller driver expects to be notified prior to
>>>> + * selectively suspending a device. xHCI hcd could optimize the endpoint
>>>> + * cache for power saving purpose. Refer to 4.15.1.1 of xHCI 1.1.
>>>> + */
>>>> +void xhci_device_suspend(struct usb_hcd *hcd,
>>>> +			struct usb_device *udev, pm_message_t msg)
>>> You never use the 'msg' field, so please remove it from the callback.
>> 'msg' could be used in another patch to determine the pm event types:
>> auto-suspend or system suspend. I didn't bring up that patch together
>> with this patch series because 1) that's part of xhci 1.1 features, and
>> 2) it's still not tested yet.
> We don't add "features" to kernel code that is not used when it is
> added.  We can always change function calls later as we do not have a
> stable api at all.

Understand it now. I will remove 'msg' fields in v4 patch series.

>
> thanks,
>
> greg k-h

Thank you.
Baolu
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>


  reply	other threads:[~2015-05-08  7:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07  2:18 [PATCH v3 0/3] usb: notify hcd when USB device suspend or resume Lu Baolu
2015-05-07  2:18 ` [PATCH v3 1/3] " Lu Baolu
2015-05-07  2:18 ` [PATCH v3 2/3] usb: xhci: implement device_suspend/device_resume entries Lu Baolu
2015-05-07 20:47   ` Greg Kroah-Hartman
2015-05-08  1:23     ` Lu, Baolu
2015-05-08  7:28       ` Greg Kroah-Hartman
2015-05-08  7:46         ` Lu, Baolu [this message]
2015-05-07  2:18 ` [PATCH v3 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend Lu Baolu

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=554C69CC.4030104@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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 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.