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

Commit d86edc41 authored by Tarun Gupta's avatar Tarun Gupta Committed by Gerrit - the friendly Code Review server
Browse files

USB: f_mbim: 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: I0cd741727c79ecf128e709d9a557004a26ef44f5
Signed-off-by: default avatarTarun Gupta <tarung@codeaurora.org>
parent 45f1dede
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -567,13 +567,14 @@ static void mbim_free_ctrl_pkt(struct ctrl_pkt *pkt)
	}
}

static struct usb_request *mbim_alloc_req(struct usb_ep *ep, int buffer_size)
static struct usb_request *mbim_alloc_req(struct usb_ep *ep, int buffer_size,
		size_t extra_buf)
{
	struct usb_request *req = usb_ep_alloc_request(ep, GFP_KERNEL);
	if (!req)
		return NULL;

	req->buf = kmalloc(buffer_size, GFP_KERNEL);
	req->buf = kmalloc(buffer_size + extra_buf, GFP_KERNEL);
	if (!req->buf) {
		usb_ep_free_request(ep, req);
		return NULL;
@@ -1510,7 +1511,8 @@ mbim_bind(struct usb_configuration *c, struct usb_function *f)
	status = -ENOMEM;

	/* allocate notification request and buffer */
	mbim->not_port.notify_req = mbim_alloc_req(ep, NCM_STATUS_BYTECOUNT);
	mbim->not_port.notify_req = mbim_alloc_req(ep, NCM_STATUS_BYTECOUNT,
				cdev->gadget->extra_buf_alloc);
	if (!mbim->not_port.notify_req) {
		pr_info("failed to allocate notify request\n");
		goto fail;