aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-08-31 11:09:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-17 12:49:24 -0400
commit9df89d85b407690afa46ddfbccc80bec6869971d (patch)
tree7e35884e7fdd3202e9f6b73729496adc72267a0b /drivers/usb
parent6c74dada4f5a37037dee1da6a8a7aeb56c558bca (diff)
usbcore: set lpm_capable field for LPM capable root hubs
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hcd.c1
-rw-r--r--drivers/usb/core/hub.c7
-rw-r--r--drivers/usb/core/usb.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index ab54999da2bf..9795a21bc612 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1033,6 +1033,7 @@ static int register_root_hub(struct usb_hcd *hcd)
1033 dev_name(&usb_dev->dev), retval); 1033 dev_name(&usb_dev->dev), retval);
1034 return retval; 1034 return retval;
1035 } 1035 }
1036 usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
1036 } 1037 }
1037 1038
1038 retval = usb_new_device (usb_dev); 1039 retval = usb_new_device (usb_dev);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index dde4c83516a1..52a1de99c6f2 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -135,7 +135,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
135 return usb_get_intfdata(hdev->actconfig->interface[0]); 135 return usb_get_intfdata(hdev->actconfig->interface[0]);
136} 136}
137 137
138static int usb_device_supports_lpm(struct usb_device *udev) 138int usb_device_supports_lpm(struct usb_device *udev)
139{ 139{
140 /* USB 2.1 (and greater) devices indicate LPM support through 140 /* USB 2.1 (and greater) devices indicate LPM support through
141 * their USB 2.0 Extended Capabilities BOS descriptor. 141 * their USB 2.0 Extended Capabilities BOS descriptor.
@@ -156,6 +156,11 @@ static int usb_device_supports_lpm(struct usb_device *udev)
156 "Power management will be impacted.\n"); 156 "Power management will be impacted.\n");
157 return 0; 157 return 0;
158 } 158 }
159
160 /* udev is root hub */
161 if (!udev->parent)
162 return 1;
163
159 if (udev->parent->lpm_capable) 164 if (udev->parent->lpm_capable)
160 return 1; 165 return 1;
161 166
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 823857767a16..c49383669cd8 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -35,6 +35,7 @@ extern int usb_get_device_descriptor(struct usb_device *dev,
35 unsigned int size); 35 unsigned int size);
36extern int usb_get_bos_descriptor(struct usb_device *dev); 36extern int usb_get_bos_descriptor(struct usb_device *dev);
37extern void usb_release_bos_descriptor(struct usb_device *dev); 37extern void usb_release_bos_descriptor(struct usb_device *dev);
38extern int usb_device_supports_lpm(struct usb_device *udev);
38extern char *usb_cache_string(struct usb_device *udev, int index); 39extern char *usb_cache_string(struct usb_device *udev, int index);
39extern int usb_set_configuration(struct usb_device *dev, int configuration); 40extern int usb_set_configuration(struct usb_device *dev, int configuration);
40extern int usb_choose_configuration(struct usb_device *udev); 41extern int usb_choose_configuration(struct usb_device *udev);