History log of /drivers/usb/gadget/f_midi.c
Revision Date Author Comments
2a5be8783e0016d15e7907ddd212b2c312e196eb 01-Mar-2012 Jesper Juhl <jj@chaosbits.net> Allocate correct size (portably) in drivers/usb/gadget/f_midi.c::f_midi_bind()

As the coverity checker puts it:

"Passing argument "sizeof (midi_function) /*8*/" to function "kcalloc"
and then casting the return value to "struct usb_descriptor_header **"
is suspicious. ... In this particular case sizeof(struct
usb_descriptor_header **) happens to be equal to sizeof(struct
usb_descriptor_header *), but this is not a portable assumption."

I believe we really do intend to use 'sizeof(*midi_function)' here, so
this patch makes that change.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
74203de067ae5c71526168b597088022836e31d3 15-Oct-2011 Daniel Mack <zonque@gmail.com> usb: gadget: fix MIDI gadget jack allocation

The dynamic jack allocation of the MIDI gadget currently links all
external jacks to one single instance of an embedded jack. According to
the spec, this is only valid if these streams always carry the same data
stream, as described in the USB MIDI 1.0 spec, chapter 3.3.1.

Also, genius Windows 7(tm) terminates it's life cycle instantly with a
blue screen of death once a device with more than one input and output
port with the current implementation is connected.

While at it, and because it grew again by this change, allocate the
temporary function pointer list on the heap, not on the stack.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0f8fd43c42f2cc249943be76a4db0d058c16b6dc 18-Oct-2011 Dan Carpenter <dan.carpenter@oracle.com> USB: gadget: midi: memory leak in f_midi_bind_config()

There is a small memory leak on the error paths.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
0889551267e7b6b4d27dc9f726f3d0cb0d976105 18-Oct-2011 Dan Carpenter <dan.carpenter@oracle.com> USB: gadget: midi: fix range check in f_midi_out_open()

! has higher precedence than >= and since neither 0 nor 1 are greater
than 8 the condition is always false.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c8933c3f79568263c90a46f06cf80419e6c63c97 28-Sep-2011 Daniel Mack <zonque@gmail.com> USB: gadget: f_midi: allow a dynamic number of input and output ports

The code in the MIDI gadget was already sort of prepared for multi-port
configuration, so the streaming logic itself didn't need much tweaking.
However, the descriptors change when the number of ports do, and so some
rework of the the preparation algorithms were necessary.

Successfully tested on Linux and Max OS X hosts for both input and
output streams.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2672eea5a38b35e6d28f851e990e110e217271eb 28-Sep-2011 Daniel Mack <zonque@gmail.com> USB: gadget: midi: refactor the device code

Make use of the newly added MIDI function in f_midi.c and strip down
the MIDI gadget code radically. Also use the generic framework function
to avoid code duplication and rename some symbols to bring them in sync
with other code in the gadget framework.

[ balbi@ti.com : fix Section mismatch warnings.
rebased on top of usb_speed_string() patch to
avoid conflicts. ]

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
d5daf49b58661ec4af7a55b277176efbf945ca05 28-Sep-2011 Daniel Mack <zonque@gmail.com> USB: gadget: midi: add midi function driver

This patch adds f_midi.c to implement a USB gadget function that works
with the composite framework, so it can be combined with other USB
functions.

The code for the ALSA/MIDI logic was taken from the midi device gadget,
other parts have been rewritten to benefit from the dynamic descriptor
allocation features.

This was successfully tested on an OMAP3 board.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>