Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ba76d07 authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

USB: f_ccid: Increase the IN endpoint buffer allocation



Some UDC may require allocation of some extra bytes for TX buffer
due to hardware requirement. Add necessary changes for the same.

Change-Id: Ia19f107a2894a4eae7f6400a27c93c357323ab68
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent e071f813
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -337,7 +337,8 @@ static void ccid_bulk_complete_out(struct usb_ep *ep, struct usb_request *req)
}

static struct usb_request *
ccid_request_alloc(struct usb_ep *ep, size_t len, gfp_t kmalloc_flags)
ccid_request_alloc(struct usb_ep *ep, size_t len, size_t extra_buf_alloc,
							gfp_t kmalloc_flags)
{
	struct usb_request *req;

@@ -345,7 +346,7 @@ ccid_request_alloc(struct usb_ep *ep, size_t len, gfp_t kmalloc_flags)

	if (req != NULL) {
		req->length = len;
		req->buf = kmalloc(len, kmalloc_flags);
		req->buf = kmalloc(len + extra_buf_alloc, kmalloc_flags);
		if (req->buf == NULL) {
			usb_ep_free_request(ep, req);
			req = NULL;
@@ -467,7 +468,8 @@ ccid_function_set_alt(struct usb_function *f, unsigned int intf,
	int i;

	ccid_dev->notify_req = ccid_request_alloc(ccid_dev->notify,
			sizeof(struct usb_ccid_notification), GFP_ATOMIC);
			sizeof(struct usb_ccid_notification),
			cdev->gadget->extra_buf_alloc, GFP_ATOMIC);
	if (IS_ERR(ccid_dev->notify_req)) {
		pr_err("%s: unable to allocate memory for notify req\n",
				__func__);
@@ -478,7 +480,7 @@ ccid_function_set_alt(struct usb_function *f, unsigned int intf,

	/* now allocate requests for our endpoints */
	req = ccid_request_alloc(ccid_dev->out, BULK_OUT_BUFFER_SIZE,
							GFP_ATOMIC);
							0, GFP_ATOMIC);
	if (IS_ERR(req)) {
		pr_err("%s: unable to allocate memory for out req\n",
				__func__);
@@ -491,7 +493,7 @@ ccid_function_set_alt(struct usb_function *f, unsigned int intf,

	for (i = 0; i < TX_REQ_MAX; i++) {
		req = ccid_request_alloc(ccid_dev->in, BULK_IN_BUFFER_SIZE,
				GFP_ATOMIC);
				cdev->gadget->extra_buf_alloc, GFP_ATOMIC);
		if (IS_ERR(req)) {
			pr_err("%s: unable to allocate memory for in req\n",
					__func__);