USB: f_mass_storage: improve async notification handling
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 13 Apr 2017 20:36:50 +0000 (16:36 -0400)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 16 May 2017 07:38:29 +0000 (10:38 +0300)
commit78db441d2ea0c804bc43a2bf3f894c4f7a6c7788
treeec136dbe1b064dc3d85acd5bc1c553a594c60213
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6
USB: f_mass_storage: improve async notification handling

This patch makes several adjustments to the way f_mass_storage.c
handles its internal state and asynchronous notifications (AKA
exceptions):

A number of states weren't being used for anything.
They are removed.

The FSG_STATE_IDLE state was renamed to FSG_STATE_NORMAL,
because it now applies whenever the gadget is operating
normally, not just when the gadget is idle.

The FSG_STATE_RESET state was renamed to
FSG_STATE_PROTOCOL_RESET, indicating that it represents a
Bulk-Only Transport protocol reset and not a general USB
reset.

When a signal arrives, it's silly for the signal handler to
send itself another signal!  Now it takes care of everything
inline.

Along with an assortment of other minor changes in the same category.

Tested-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/storage_common.h