From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751768AbbEGUrR (ORCPT ); Thu, 7 May 2015 16:47:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44862 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbbEGUrO (ORCPT ); Thu, 7 May 2015 16:47:14 -0400 Date: Thu, 7 May 2015 22:47:10 +0200 From: Greg Kroah-Hartman To: Lu Baolu Cc: Mathias Nyman , Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] usb: xhci: implement device_suspend/device_resume entries Message-ID: <20150507204710.GB28684@kroah.com> References: <1430965096-8431-1-git-send-email-baolu.lu@linux.intel.com> <1430965096-8431-3-git-send-email-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430965096-8431-3-git-send-email-baolu.lu@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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. > +{ > + struct xhci_hcd *xhci; > + > + xhci = hcd_to_xhci(hcd); > + if (!xhci || !xhci->devs[udev->slot_id]) > + return; > + > + xhci_stop_device(xhci, udev->slot_id, 1); > +} > + > +/* > + * xHCI compatible host controller driver expects to be notified after a > + * USB device is resumed. xHCI hcd could optimize the endpoint cache > + * to reduce the latency. Refer to 4.15.1.1 of xHCI 1.1. > + */ > +void xhci_device_resume(struct usb_hcd *hcd, > + struct usb_device *udev, pm_message_t msg) Same here.