Commit 6b2d5150 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Greg Kroah-Hartman

[PATCH] usb/mdc800: cleanup set_current_state() around wait queues

This patch cleans up the wait queue usage in this driver.  The state is
no longer set until just before the task sleeps, which removes a few
set_current_state()s. Correspondingly, the state doesn't need to be set
back to TASK_RUNNING outside of the while-loops, as schedule_timeout()
takes care of it.
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent bd8a148a
......@@ -317,7 +317,6 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
mdc800->camera_request_ready=1+mode;
add_wait_queue(&mdc800->irq_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
timeout = msec*HZ/1000;
while (!mdc800->irq_woken && timeout)
{
......@@ -325,7 +324,6 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
timeout = schedule_timeout (timeout);
}
remove_wait_queue(&mdc800->irq_wait, &wait);
set_current_state(TASK_RUNNING);
mdc800->irq_woken = 0;
if (mdc800->camera_request_ready>0)
......@@ -725,7 +723,6 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout (timeout);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&mdc800->download_wait, &wait);
mdc800->downloaded = 0;
if (mdc800->download_urb->status != 0)
......@@ -851,7 +848,6 @@ static ssize_t mdc800_device_write (struct file *file, const char __user *buf, s
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout (timeout);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&mdc800->write_wait, &wait);
mdc800->written = 0;
if (mdc800->state == WORKING)
......
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