diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2014-10-16 13:33:25 +0200 |
---|---|---|
committer | Badhri Jagan Sridharan <Badhri@google.com> | 2015-09-04 12:25:03 -0700 |
commit | 4158b96a16aaa6da4c6b588fa267027bbc04ae2c (patch) | |
tree | f3588a5c71cf8af056d6d27eaf589d08389703f9 | |
parent | 3f1694ac7562fd9f2aee85c2b6d1f93424f06dcb (diff) |
usb: gadget: f_midi: enable use of the index parameter
The soundcard index to use for the ALSA device creation is passed as a
parameter to f_midi_bind_config(), but is assigned to midi->index only
after the call to f_midi_register_card(midi). So no matter what is passed
to f_midi_bind_config(), the actual index for snd_card_new() is always 0.
This probably works ok if at the moment of f_midi's bind there are no
other snd_cards, but if there are, it is not possible to bind f_midi.
This patch moves the assignment to a place before the call to
f_midi_register_card(midi).
BACKPORT FROM MAINLINE KERNEL
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Ia2a2c95b165dd3575b03b0928ff2322349b73e24
-rw-r--r-- | drivers/usb/gadget/function/f_midi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 807b31c0edc3..bf329578c957 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -954,6 +954,7 @@ int __init f_midi_bind_config(struct usb_configuration *c, /* set up ALSA midi devices */ midi->in_ports = in_ports; midi->out_ports = out_ports; + midi->index = index; status = f_midi_register_card(midi); if (status < 0) goto setup_fail; @@ -966,7 +967,6 @@ int __init f_midi_bind_config(struct usb_configuration *c, midi->func.disable = f_midi_disable; midi->id = kstrdup(id, GFP_KERNEL); - midi->index = index; midi->buflen = buflen; midi->qlen = qlen; |