mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
d9c61bb33f
We move the func_utils.h header to include/linux/usb to be able to compile function drivers outside of the drivers/usb/gadget/function directory. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.kernel.org/r/20240116-ml-topic-u9p-v12-1-9a27de5160e0@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31 lines
707 B
C
31 lines
707 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 <linux/usb/ch9.h>
|
|
#include <linux/usb/func_utils.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);
|