Commit 49cb01f6 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] PATCH: usb-storage: consolidate, cleanup, etc.

This patch fixes some spelling errors and adds some BUG_ON() calls so we
can make sure that all this new code is working properly.
parent 38b27b6e
......@@ -114,9 +114,10 @@ static int release(struct Scsi_Host *psh)
/* Kill the control threads
*
* Enqueue the command, wake up the thread, and wait for
* notification that it's exited.
* notification that it has exited.
*/
US_DEBUGP("-- sending exit command to thread\n");
BUG_ON(atomic_read(&us->sm_state) != US_STATE_IDLE);
us->srb = NULL;
up(&(us->sema));
wait_for_completion(&(us->notify));
......@@ -136,7 +137,7 @@ static int command( Scsi_Cmnd *srb )
return DID_BAD_TARGET << 16;
}
/* run command */
/* queue a command */
/* This is always called with scsi_lock(srb->host) held */
static int queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
{
......@@ -146,6 +147,7 @@ static int queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
srb->host_scribble = (unsigned char *)us;
/* enqueue the command */
BUG_ON(atomic_read(&us->sm_state) != US_STATE_IDLE || us->srb != NULL);
srb->scsi_done = done;
us->srb = srb;
......@@ -186,6 +188,7 @@ static int device_reset( Scsi_Cmnd *srb )
int result;
US_DEBUGP("device_reset() called\n" );
BUG_ON(atomic_read(&us->sm_state) != US_STATE_IDLE);
/* set the state and release the lock */
atomic_set(&us->sm_state, US_STATE_RESETTING);
......
......@@ -849,6 +849,7 @@ void usb_stor_abort_transport(struct us_data *us)
/* Normally the current state is RUNNING. If the control thread
* hasn't even started processing this command, the state will be
* IDLE. Anything else is a bug. */
BUG_ON((state != US_STATE_RUNNING && state != US_STATE_IDLE));
/* set state to abort and release the lock */
atomic_set(&us->sm_state, US_STATE_ABORTING);
......
......@@ -473,7 +473,7 @@ static int usb_stor_control_thread(void * __us)
}
/* Set up the URB, the usb_ctrlrequest, and the IRQ pipe and handler.
* ss->dev_semaphore should already be locked.
* ss->dev_semaphore must already be locked.
* Note that this function assumes that all the data in the us_data
* strucuture is current. This includes the ep_int field, which gives us
* the endpoint for the interrupt.
......
......@@ -131,7 +131,6 @@ struct us_data {
*/
struct semaphore dev_semaphore; /* protect pusb_dev */
struct usb_device *pusb_dev; /* this usb_device */
unsigned long flags; /* from filter initially */
/* information about the device -- always good */
......@@ -165,7 +164,7 @@ struct us_data {
/* thread information */
int pid; /* control thread */
atomic_t sm_state;
atomic_t sm_state; /* what we are doing */
/* interrupt info for CBI devices -- only good if attached */
struct semaphore ip_waitq; /* for CBI interrupts */
......@@ -177,7 +176,7 @@ struct us_data {
unsigned char irqdata[2]; /* data from USB IRQ */
/* control and bulk communications data */
struct semaphore current_urb_sem; /* to protect irq_urb */
struct semaphore current_urb_sem; /* protect current_urb */
struct urb *current_urb; /* non-int USB requests */
struct usb_ctrlrequest *dr; /* control requests */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment