1 // SPDX-License-Identifier: GPL-2.0
3 * u_f.c -- USB function utilities for Gadget stack
5 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com
8 * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
12 #include <linux/usb/ch9.h>
14 struct usb_request
*alloc_ep_req(struct usb_ep
*ep
, size_t len
)
16 struct usb_request
*req
;
18 req
= usb_ep_alloc_request(ep
, GFP_ATOMIC
);
20 req
->length
= usb_endpoint_dir_out(ep
->desc
) ?
21 usb_ep_align(ep
, len
) : len
;
22 req
->buf
= kmalloc(req
->length
, GFP_ATOMIC
);
24 usb_ep_free_request(ep
, req
);
30 EXPORT_SYMBOL_GPL(alloc_ep_req
);