aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-09-10 09:01:51 -0400
committerFelipe Balbi <balbi@ti.com>2012-09-10 09:00:01 -0400
commite13f17ff8854e04cfc6b9f981a974f55d8da9b92 (patch)
tree9342ea309b44de0d0869d10728d03ad06ecd67f7 /drivers/usb/gadget/composite.c
parentdc995fc27c2e1c8edebfb2405ede23bd38153f7f (diff)
usb: gadget: move USB_BUFSIZ into global composite.h
This patch moves USB_BUFSIZ into global header file as USB_COMP_EP0_BUFSIZ. There is currently only one user (f_sourcesink) besides composite which need it. Ideally f_sourcesink would have its own ep0 buffer. Lets keep it that way it was for now. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 0b6ee2012af1..52689ee9db12 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -28,9 +28,6 @@
28 * with the relevant device-wide data. 28 * with the relevant device-wide data.
29 */ 29 */
30 30
31/* big enough to hold our biggest descriptor */
32#define USB_BUFSIZ 1024
33
34/* Some systems will need runtime overrides for the product identifiers 31/* Some systems will need runtime overrides for the product identifiers
35 * published in the device descriptor, either numbers or strings or both. 32 * published in the device descriptor, either numbers or strings or both.
36 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters). 33 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
@@ -355,10 +352,11 @@ static int config_buf(struct usb_configuration *config,
355{ 352{
356 struct usb_config_descriptor *c = buf; 353 struct usb_config_descriptor *c = buf;
357 void *next = buf + USB_DT_CONFIG_SIZE; 354 void *next = buf + USB_DT_CONFIG_SIZE;
358 int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE; 355 int len;
359 struct usb_function *f; 356 struct usb_function *f;
360 int status; 357 int status;
361 358
359 len = USB_COMP_EP0_BUFSIZ - USB_DT_CONFIG_SIZE;
362 /* write the config descriptor */ 360 /* write the config descriptor */
363 c = buf; 361 c = buf;
364 c->bLength = USB_DT_CONFIG_SIZE; 362 c->bLength = USB_DT_CONFIG_SIZE;
@@ -1445,13 +1443,13 @@ static int composite_bind(struct usb_gadget *gadget,
1445 cdev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); 1443 cdev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
1446 if (!cdev->req) 1444 if (!cdev->req)
1447 goto fail; 1445 goto fail;
1448 cdev->req->buf = kmalloc(USB_BUFSIZ, GFP_KERNEL); 1446 cdev->req->buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL);
1449 if (!cdev->req->buf) 1447 if (!cdev->req->buf)
1450 goto fail; 1448 goto fail;
1451 cdev->req->complete = composite_setup_complete; 1449 cdev->req->complete = composite_setup_complete;
1452 gadget->ep0->driver_data = cdev; 1450 gadget->ep0->driver_data = cdev;
1453 1451
1454 cdev->bufsiz = USB_BUFSIZ; 1452 cdev->bufsiz = USB_COMP_EP0_BUFSIZ;
1455 cdev->driver = composite; 1453 cdev->driver = composite;
1456 1454
1457 /* 1455 /*