usb: gadget: f_midi: allow resetting index option
authorJohn Keeping <john@metanate.com>
Fri, 29 Oct 2021 13:41:14 +0000 (14:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 13:40:43 +0000 (14:40 +0100)
commitd429976170a5699ef2cc03e3e3abfc06098754cc
tree9f93ad7b842e183e65a9e4b5a6b6fdfdc9c37e33
parentf057a1d4f0d2cf66f6a4b578c846bbb1d0eb0223
usb: gadget: f_midi: allow resetting index option

Unlike the other integral options supported by the MIDI gadget, index is
a signed integer and defaults to -1, which means "choose any sound card
index".  The generic store routine parses input into a u32 which fails
to properly read -1 if an attempt is made to set the value to the
default.

Add a new macro block for signed values to fix this, and use the correct
format string for unsigned values.

Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20211029134115.351008-1-john@metanate.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_midi.c