[PATCH 08/10] USB: EHCI: use descriptor length fields

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Wed Jul 23 06:51:49 PDT 2014


Instead of hard-coding descriptor length, pick it from the
corresponding descriptor.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
---
To: Sascha Hauer <s.hauer at pengutronix.de>
Cc: barebox at lists.infradead.org
---
 drivers/usb/host/ehci-hcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a3063f988da0..ab1bc0331ba1 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -503,12 +503,12 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 		case USB_DT_DEVICE:
 			dev_dbg(ehci->dev, "USB_DT_DEVICE request\n");
 			srcptr = &descriptor.device;
-			srclen = 0x12;
+			srclen = descriptor.device.bLength;
 			break;
 		case USB_DT_CONFIG:
 			dev_dbg(ehci->dev, "USB_DT_CONFIG config\n");
 			srcptr = &descriptor.config;
-			srclen = 0x19;
+			srclen = le16_to_cpu(descriptor.config.wTotalLength);
 			break;
 		case USB_DT_STRING:
 			dev_dbg(ehci->dev, "USB_DT_STRING config\n");
@@ -543,7 +543,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 		case USB_DT_HUB:
 			dev_dbg(ehci->dev, "USB_DT_HUB config\n");
 			srcptr = &descriptor.hub;
-			srclen = 0x8;
+			srclen = descriptor.hub.bLength;
 			break;
 		default:
 			dev_dbg(ehci->dev, "unknown value %x\n", le16_to_cpu(req->value));
-- 
2.0.0




More information about the barebox mailing list