Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28352
b: refs/heads/master
c: 3428cc4
h: refs/heads/master
v: v3
  • Loading branch information
Franck Bui-Huu authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 1c03867 commit 5d2dd3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80b47853b19114dd53e83e15bf1db3e183a66824
refs/heads/master: 3428cc43d23f125dcb31c981aa91535dd3c4cb0d
38 changes: 10 additions & 28 deletions trunk/drivers/usb/storage/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,6 @@ static void usb_stor_blocking_completion(struct urb *urb, struct pt_regs *regs)

complete(urb_done_ptr);
}

/* This is the timeout handler which will cancel an URB when its timeout
* expires.
*/
static void timeout_handler(unsigned long us_)
{
struct us_data *us = (struct us_data *) us_;

if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) {
US_DEBUGP("Timeout -- cancelling URB\n");
usb_unlink_urb(us->current_urb);
}
}

/* This is the common part of the URB message submission code
*
Expand All @@ -138,7 +125,7 @@ static void timeout_handler(unsigned long us_)
static int usb_stor_msg_common(struct us_data *us, int timeout)
{
struct completion urb_done;
struct timer_list to_timer;
long timeleft;
int status;

/* don't submit URBs during abort/disconnect processing */
Expand Down Expand Up @@ -185,22 +172,17 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
}
}

/* submit the timeout timer, if a timeout was requested */
if (timeout > 0) {
init_timer(&to_timer);
to_timer.expires = jiffies + timeout;
to_timer.function = timeout_handler;
to_timer.data = (unsigned long) us;
add_timer(&to_timer);
}

/* wait for the completion of the URB */
wait_for_completion(&urb_done);
clear_bit(US_FLIDX_URB_ACTIVE, &us->flags);
timeleft = wait_for_completion_interruptible_timeout(
&urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT);

/* clean up the timeout timer */
if (timeout > 0)
del_timer_sync(&to_timer);
clear_bit(US_FLIDX_URB_ACTIVE, &us->flags);

if (timeleft <= 0) {
US_DEBUGP("%s -- cancelling URB\n",
timeleft == 0 ? "Timeout" : "Signal");
usb_unlink_urb(us->current_urb);
}

/* return the URB status */
return us->current_urb->status;
Expand Down

0 comments on commit 5d2dd3d

Please sign in to comment.