xhci: Fix warning introduced by disabling runtime PM. 49/155649/1
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Wed, 28 Aug 2013 16:31:04 +0000 (09:31 -0700)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 16 Oct 2017 01:36:01 +0000 (10:36 +0900)
commitf086cb4615b37d9a8dc8b8727f86009154f4038c
treebaa182568779b5728059f8ffdc5e6bd4b52bc934
parente3c62de48c4fd9563e020310f1328dfbc2aa173d
xhci: Fix warning introduced by disabling runtime PM.

The 0day build server caught a new build warning that is triggered when
CONFIG_USB_DEFAULT_PERSIST is turned on:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git for-usb-next
head:   0730d52a86919300a39a2be37f6c140997dfb82f
commit: c8476fb855434c733099079063990e5bfa7ecad6 [1/3] usb: xhci: Disable runtime PM suspend for quirky controllers
config: i386-randconfig-r6-0826 (attached as .config)

All warnings:

   drivers/usb/host/xhci.c: In function 'xhci_free_dev':
>> drivers/usb/host/xhci.c:3560:17: warning: unused variable 'dev' [-Wunused-variable]
     struct device *dev = hcd->self.controller;
                    ^
   drivers/usb/host/xhci.c: In function 'xhci_alloc_dev':
>> drivers/usb/host/xhci.c:3648:17: warning: unused variable 'dev' [-Wunused-variable]
     struct device *dev = hcd->self.controller;
                    ^

vim +/dev +3560 drivers/usb/host/xhci.c

  3554   * disabled.  Free any HC data structures associated with that device.
  3555   */
  3556  void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
  3557  {
  3558          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
  3559          struct xhci_virt_device *virt_dev;
> 3560          struct device *dev = hcd->self.controller;
  3561          unsigned long flags;
  3562          u32 state;
  3563          int i, ret;
  3564
  3565  #ifndef CONFIG_USB_DEFAULT_PERSIST
  3566          /*
  3567           * We called pm_runtime_get_noresume when the device was attached.
  3568           * Decrement the counter here to allow controller to runtime suspend
  3569           * if no devices remain.
  3570           */
  3571          if (xhci->quirks & XHCI_RESET_ON_RESUME)
  3572                  pm_runtime_put_noidle(dev);
  3573  #endif
  3574
...
  3641  /*
  3642   * Returns 0 if the xHC ran out of device slots, the Enable Slot command
  3643   * timed out, or allocating memory failed.  Returns 1 on success.
  3644   */
  3645  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
  3646  {
  3647          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> 3648          struct device *dev = hcd->self.controller;
  3649          unsigned long flags;
  3650          int timeleft;
  3651          int ret;

Fix this.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Shawn Nematbakhsh <shawnn@chromium.org>
[sw0312.kim: cherry-pick from mainline to remove build warning]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I16dccdaacd8736bf0b0169765bb4e46f6eb27fed
drivers/usb/host/xhci.c