diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2013-11-07 08:41:26 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-11-26 13:41:32 -0600 |
commit | 1efd54eab2b60c68c2ce75ea635306cef847d751 (patch) | |
tree | b810315964acc35866cf4cda9c1032a6c71e83bf /drivers/usb/gadget/f_hid.c | |
parent | a01091e5ce866562ea2638a80f2241d8d6bde164 (diff) | |
download | linux-stable-1efd54eab2b60c68c2ce75ea635306cef847d751.tar.gz linux-stable-1efd54eab2b60c68c2ce75ea635306cef847d751.tar.bz2 linux-stable-1efd54eab2b60c68c2ce75ea635306cef847d751.zip |
usb: gadget: factor out alloc_ep_req
alloc_ep_req() is a function repeated in several modules.
Make a common implementation and use it.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_hid.c')
-rw-r--r-- | drivers/usb/gadget/f_hid.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c index 6e69a8e8d22a..a95290a1289f 100644 --- a/drivers/usb/gadget/f_hid.c +++ b/drivers/usb/gadget/f_hid.c @@ -20,6 +20,8 @@ #include <linux/sched.h> #include <linux/usb/g_hid.h> +#include "u_f.h" + static int major, minors; static struct class *hidg_class; @@ -334,20 +336,10 @@ static int f_hidg_open(struct inode *inode, struct file *fd) /*-------------------------------------------------------------------------*/ /* usb_function */ -static struct usb_request *hidg_alloc_ep_req(struct usb_ep *ep, unsigned length) +static inline struct usb_request *hidg_alloc_ep_req(struct usb_ep *ep, + unsigned length) { - struct usb_request *req; - - req = usb_ep_alloc_request(ep, GFP_ATOMIC); - if (req) { - req->length = length; - req->buf = kmalloc(length, GFP_ATOMIC); - if (!req->buf) { - usb_ep_free_request(ep, req); - req = NULL; - } - } - return req; + return alloc_ep_req(ep, length, length); } static void hidg_set_report_complete(struct usb_ep *ep, struct usb_request *req) |