Skip to content

Commit

Permalink
usb: gadget: midi: avoid redundant f_midi_set_alt() call
Browse files Browse the repository at this point in the history
Function midi registers two interfaces with single set_alt() function
which means that f_midi_set_alt() is called twice when configuration
is set. That means that endpoint initialization and ep request allocation
is done two times. To avoid this problem we do such things only once,
for interface number 1 (MIDI Streaming interface).

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Robert Baldyga authored and Felipe Balbi committed Jul 31, 2015
1 parent 55d8112 commit 4ef7a4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/gadget/function/f_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
unsigned i;
int err;

/* For Control Device interface we do nothing */
if (intf == 0)
return 0;

err = f_midi_start_ep(midi, f, midi->in_ep);
if (err)
return err;
Expand Down

0 comments on commit 4ef7a4a

Please sign in to comment.