mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
225785aec7
This patch reworks the way f_mass_storage.c handles memory barriers and synchronization: The driver now uses a wait_queue instead of doing its own task-state manipulations (even though only one task will ever use the wait_queue). The thread_wakeup_needed variable is removed. It was only a source of trouble; although it was what the driver tested to see whether it should wake up, what we really wanted to see was whether a USB transfer had completed. All the explicit memory barriers scattered throughout the driver are replaced by a few calls to smp_load_acquire() and smp_store_release(). The inreq_busy and outreq_busy fields are removed. In their place, the driver keeps track of the current I/O direction by splitting BUF_STATE_BUSY into two states: BUF_STATE_SENDING and BUF_STATE_RECEIVING. The buffer states are no longer protected by a lock. Mutual exclusion isn't needed; the state is changed only by the driver's main thread when it owns the buffer, and only by the request completion routine when the gadget core owns the buffer. The do_write() and throw_away_data() routines were reorganized to make efficient use of the new sleeping mechanism. This resulted in the removal of one indentation level in those routines, making the patch appear to be more more complicated than it really is. In a few places, the driver allowed itself to be frozen although it really shouldn't have (in the middle of executing a SCSI command). Those places have been fixed. The logic in the exception handler for aborting transfers and waiting for them to stop has been simplified. 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> |
||
---|---|---|
.. | ||
f_acm.c | ||
f_ecm.c | ||
f_eem.c | ||
f_fs.c | ||
f_hid.c | ||
f_loopback.c | ||
f_mass_storage.c | ||
f_mass_storage.h | ||
f_midi.c | ||
f_ncm.c | ||
f_obex.c | ||
f_phonet.c | ||
f_printer.c | ||
f_rndis.c | ||
f_serial.c | ||
f_sourcesink.c | ||
f_subset.c | ||
f_tcm.c | ||
f_uac1.c | ||
f_uac2.c | ||
f_uvc.c | ||
f_uvc.h | ||
g_zero.h | ||
Makefile | ||
ndis.h | ||
rndis.c | ||
rndis.h | ||
storage_common.c | ||
storage_common.h | ||
tcm.h | ||
u_ecm.h | ||
u_eem.h | ||
u_ether_configfs.h | ||
u_ether.c | ||
u_ether.h | ||
u_fs.h | ||
u_gether.h | ||
u_hid.h | ||
u_midi.h | ||
u_ncm.h | ||
u_phonet.h | ||
u_printer.h | ||
u_rndis.h | ||
u_serial.c | ||
u_serial.h | ||
u_tcm.h | ||
u_uac1.c | ||
u_uac1.h | ||
u_uac2.h | ||
u_uvc.h | ||
uvc_configfs.c | ||
uvc_configfs.h | ||
uvc_queue.c | ||
uvc_queue.h | ||
uvc_v4l2.c | ||
uvc_v4l2.h | ||
uvc_video.c | ||
uvc_video.h | ||
uvc.h |