mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-09-04 20:19:47 +08:00 
			
		
		
		
	 1b4a3b5171
			
		
	
	
		1b4a3b5171
		
	
	
	
	
		
			
			My @samusung.com address is going to cease existing soon, so change it to an address which can actually be used to contact me. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
		
			
				
	
	
		
			31 lines
		
	
	
		
			690 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			690 B
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0
 | |
| /*
 | |
|  * u_f.c -- USB function utilities for Gadget stack
 | |
|  *
 | |
|  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 | |
|  *		http://www.samsung.com
 | |
|  *
 | |
|  * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
 | |
|  */
 | |
| 
 | |
| #include "u_f.h"
 | |
| #include <linux/usb/ch9.h>
 | |
| 
 | |
| struct usb_request *alloc_ep_req(struct usb_ep *ep, size_t len)
 | |
| {
 | |
| 	struct usb_request      *req;
 | |
| 
 | |
| 	req = usb_ep_alloc_request(ep, GFP_ATOMIC);
 | |
| 	if (req) {
 | |
| 		req->length = usb_endpoint_dir_out(ep->desc) ?
 | |
| 			usb_ep_align(ep, len) : len;
 | |
| 		req->buf = kmalloc(req->length, GFP_ATOMIC);
 | |
| 		if (!req->buf) {
 | |
| 			usb_ep_free_request(ep, req);
 | |
| 			req = NULL;
 | |
| 		}
 | |
| 	}
 | |
| 	return req;
 | |
| }
 | |
| EXPORT_SYMBOL_GPL(alloc_ep_req);
 |