Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1450816
| From | "Felipe F. Tonello" <eu@felipetonello.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint |
| Date | 2016-07-26 21:20 +0200 |
| Message-ID | <rZg3w-616-33@gated-at.bofh.it> (permalink) |
| References | <rZg3v-616-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This change makes sure that the ALSA buffers are cleaned if an endpoint
becomes disabled.
Before this change, if the internal ALSA buffer did overflow, the MIDI
function would stop sending MIDI to the host.
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
drivers/usb/gadget/function/f_midi.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 09d769e18b50..3a47596afcab 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -305,6 +305,19 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req)
}
}
+static void f_midi_drop_out_substreams(struct f_midi *midi)
+{
+ unsigned int i;
+
+ for (i = 0; i < midi->in_ports; i++) {
+ struct gmidi_in_port *port = midi->in_ports_array + i;
+ struct snd_rawmidi_substream *substream = port->substream;
+
+ if (port->active && substream)
+ snd_rawmidi_drop_output(substream);
+ }
+}
+
static int f_midi_start_ep(struct f_midi *midi,
struct usb_function *f,
struct usb_ep *ep)
@@ -402,6 +415,8 @@ static void f_midi_disable(struct usb_function *f)
/* release IN requests */
while (kfifo_get(&midi->in_req_fifo, &req))
free_ep_req(midi->in_ep, req);
+
+ f_midi_drop_out_substreams(midi);
}
static int f_midi_snd_free(struct snd_device *device)
@@ -571,18 +586,6 @@ static void f_midi_transmit_byte(struct usb_request *req,
port->state = next_state;
}
-static void f_midi_drop_out_substreams(struct f_midi *midi)
-{
- unsigned int i;
-
- for (i = 0; i < midi->in_ports; i++) {
- struct gmidi_in_port *port = midi->in_ports_array + i;
- struct snd_rawmidi_substream *substream = port->substream;
- if (port->active && substream)
- snd_rawmidi_drop_output(substream);
- }
-}
-
static int f_midi_do_transmit(struct f_midi *midi, struct usb_ep *ep)
{
struct usb_request *req = NULL;
--
2.9.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/9] Gadget endpoint request allocation and MIDI "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
[PATCH 6/9] usb: gadget: f_midi: drop substreams when disabling endpoint "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
[PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
Re: [PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint Michal Nazarewicz <mina86@mina86.com> - 2016-07-27 22:00 +0200
Re: [PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint Felipe Ferreri Tonello <eu@felipetonello.com> - 2016-08-02 19:50 +0200
[PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512 "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
Re: [PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512 Michal Nazarewicz <mina86@mina86.com> - 2016-07-27 21:40 +0200
[PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req() "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
[PATCH 3/9] usb: gadget: f_midi: remove alignment code for OUT endpoint "Felipe F. Tonello" <eu@felipetonello.com> - 2016-07-26 21:20 +0200
csiph-web