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

Commit 7aed8928 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: f_ccid: Increase the IN endpoint buffer allocation"

parents 7a9241c6 5ba76d07
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -337,14 +337,15 @@ static struct device_attribute *audio_source_function_attributes[] = {

/*--------------------------------------------------------------------------*/

static struct usb_request *audio_request_new(struct usb_ep *ep, int buffer_size)
static struct usb_request *audio_request_new(struct usb_ep *ep, int buffer_size,
					size_t extra_buf_alloc)
{
	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_alloc, GFP_KERNEL);
	if (!req->buf) {
		usb_ep_free_request(ep, req);
		return NULL;
@@ -748,7 +749,8 @@ audio_bind(struct usb_configuration *c, struct usb_function *f)
	f->ss_descriptors = ss_audio_desc;

	for (i = 0, status = 0; i < IN_EP_REQ_COUNT && status == 0; i++) {
		req = audio_request_new(ep, IN_EP_MAX_PACKET_SIZE);
		req = audio_request_new(ep, IN_EP_MAX_PACKET_SIZE,
						cdev->gadget->extra_buf_alloc);
		if (req) {
			req->context = audio;
			req->complete = audio_data_complete;
+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__);