|
@@ -32,6 +32,8 @@
|
|
|
#include <linux/usb/audio.h>
|
|
|
#include <linux/usb/midi.h>
|
|
|
|
|
|
+#include "u_f.h"
|
|
|
+
|
|
|
MODULE_AUTHOR("Ben Williamson");
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
|
@@ -191,20 +193,10 @@ static struct usb_gadget_strings *midi_strings[] = {
|
|
|
NULL,
|
|
|
};
|
|
|
|
|
|
-static struct usb_request *alloc_ep_req(struct usb_ep *ep, unsigned length)
|
|
|
+static inline struct usb_request *midi_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 free_ep_req(struct usb_ep *ep, struct usb_request *req)
|
|
@@ -365,7 +357,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
|
|
/* allocate a bunch of read buffers and queue them all at once. */
|
|
|
for (i = 0; i < midi->qlen && err == 0; i++) {
|
|
|
struct usb_request *req =
|
|
|
- alloc_ep_req(midi->out_ep, midi->buflen);
|
|
|
+ midi_alloc_ep_req(midi->out_ep, midi->buflen);
|
|
|
if (req == NULL)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -546,7 +538,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req)
|
|
|
return;
|
|
|
|
|
|
if (!req)
|
|
|
- req = alloc_ep_req(ep, midi->buflen);
|
|
|
+ req = midi_alloc_ep_req(ep, midi->buflen);
|
|
|
|
|
|
if (!req) {
|
|
|
ERROR(midi, "gmidi_transmit: alloc_ep_request failed\n");
|