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>
This commit is contained in:
Родитель
dc995fc27c
Коммит
e13f17ff88
|
@ -28,9 +28,6 @@
|
||||||
* with the relevant device-wide data.
|
* with the relevant device-wide data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* big enough to hold our biggest descriptor */
|
|
||||||
#define USB_BUFSIZ 1024
|
|
||||||
|
|
||||||
/* Some systems will need runtime overrides for the product identifiers
|
/* Some systems will need runtime overrides for the product identifiers
|
||||||
* published in the device descriptor, either numbers or strings or both.
|
* published in the device descriptor, either numbers or strings or both.
|
||||||
* String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
|
* 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,
|
||||||
{
|
{
|
||||||
struct usb_config_descriptor *c = buf;
|
struct usb_config_descriptor *c = buf;
|
||||||
void *next = buf + USB_DT_CONFIG_SIZE;
|
void *next = buf + USB_DT_CONFIG_SIZE;
|
||||||
int len = USB_BUFSIZ - USB_DT_CONFIG_SIZE;
|
int len;
|
||||||
struct usb_function *f;
|
struct usb_function *f;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
len = USB_COMP_EP0_BUFSIZ - USB_DT_CONFIG_SIZE;
|
||||||
/* write the config descriptor */
|
/* write the config descriptor */
|
||||||
c = buf;
|
c = buf;
|
||||||
c->bLength = USB_DT_CONFIG_SIZE;
|
c->bLength = USB_DT_CONFIG_SIZE;
|
||||||
|
@ -1445,13 +1443,13 @@ static int composite_bind(struct usb_gadget *gadget,
|
||||||
cdev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
|
cdev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
|
||||||
if (!cdev->req)
|
if (!cdev->req)
|
||||||
goto fail;
|
goto fail;
|
||||||
cdev->req->buf = kmalloc(USB_BUFSIZ, GFP_KERNEL);
|
cdev->req->buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL);
|
||||||
if (!cdev->req->buf)
|
if (!cdev->req->buf)
|
||||||
goto fail;
|
goto fail;
|
||||||
cdev->req->complete = composite_setup_complete;
|
cdev->req->complete = composite_setup_complete;
|
||||||
gadget->ep0->driver_data = cdev;
|
gadget->ep0->driver_data = cdev;
|
||||||
|
|
||||||
cdev->bufsiz = USB_BUFSIZ;
|
cdev->bufsiz = USB_COMP_EP0_BUFSIZ;
|
||||||
cdev->driver = composite;
|
cdev->driver = composite;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -795,7 +795,7 @@ static int sourcesink_setup(struct usb_configuration *c,
|
||||||
u16 w_value = le16_to_cpu(ctrl->wValue);
|
u16 w_value = le16_to_cpu(ctrl->wValue);
|
||||||
u16 w_length = le16_to_cpu(ctrl->wLength);
|
u16 w_length = le16_to_cpu(ctrl->wLength);
|
||||||
|
|
||||||
req->length = USB_BUFSIZ;
|
req->length = USB_COMP_EP0_BUFSIZ;
|
||||||
|
|
||||||
/* composite driver infrastructure handles everything except
|
/* composite driver infrastructure handles everything except
|
||||||
* the two control test requests.
|
* the two control test requests.
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
*/
|
*/
|
||||||
#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
|
#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
|
||||||
|
|
||||||
|
/* big enough to hold our biggest descriptor */
|
||||||
|
#define USB_COMP_EP0_BUFSIZ 1024
|
||||||
|
|
||||||
struct usb_configuration;
|
struct usb_configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче