Commit 1e7c2cd28dc4ea3a86266fcfd07700e3911716a5

Authored by Xenia Ragiadakou
Committed by Greg Kroah-Hartman
1 parent a35bbad652

usbcore: set lpm_capable field for LPM capable root hubs

commit 9df89d85b407690afa46ddfbccc80bec6869971d upstream.

This patch sets the lpm_capable field for root hubs with LPM capabilities.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Reported-by: Martin MOKREJS <mmokrejs@gmail.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 3 changed files with 8 additions and 1 deletions Side-by-side Diff

drivers/usb/core/hcd.c
... ... @@ -1035,6 +1035,7 @@
1035 1035 dev_name(&usb_dev->dev), retval);
1036 1036 return retval;
1037 1037 }
  1038 + usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
1038 1039 }
1039 1040  
1040 1041 retval = usb_new_device (usb_dev);
drivers/usb/core/hub.c
... ... @@ -135,7 +135,7 @@
135 135 return usb_get_intfdata(hdev->actconfig->interface[0]);
136 136 }
137 137  
138   -static int usb_device_supports_lpm(struct usb_device *udev)
  138 +int usb_device_supports_lpm(struct usb_device *udev)
139 139 {
140 140 /* USB 2.1 (and greater) devices indicate LPM support through
141 141 * their USB 2.0 Extended Capabilities BOS descriptor.
... ... @@ -156,6 +156,11 @@
156 156 "Power management will be impacted.\n");
157 157 return 0;
158 158 }
  159 +
  160 + /* udev is root hub */
  161 + if (!udev->parent)
  162 + return 1;
  163 +
159 164 if (udev->parent->lpm_capable)
160 165 return 1;
161 166  
drivers/usb/core/usb.h
... ... @@ -35,6 +35,7 @@
35 35 unsigned int size);
36 36 extern int usb_get_bos_descriptor(struct usb_device *dev);
37 37 extern void usb_release_bos_descriptor(struct usb_device *dev);
  38 +extern int usb_device_supports_lpm(struct usb_device *udev);
38 39 extern char *usb_cache_string(struct usb_device *udev, int index);
39 40 extern int usb_set_configuration(struct usb_device *dev, int configuration);
40 41 extern int usb_choose_configuration(struct usb_device *udev);