and use completion timeout instead.

Signed-off-by: Franck Bui-Huu <[EMAIL PROTECTED]>


---

drivers/usb/storage/transport.c |   34 ++++++----------------------------
1 files changed, 6 insertions(+), 28 deletions(-)

c35738d918f56fbb725b29c8098cee819e33a83d
drivers/usb/storage/transport.c |   34 ++++++----------------------------
1 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 7ca896a..023700d 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -115,19 +115,6 @@ static void usb_stor_blocking_completion

        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
 *
@@ -138,7 +125,6 @@ static void timeout_handler(unsigned lon
static int usb_stor_msg_common(struct us_data *us, int timeout)
{
        struct completion urb_done;
-       struct timer_list to_timer;
        int status;

        /* don't submit URBs during abort/disconnect processing */
@@ -185,22 +171,14 @@ static int usb_stor_msg_common(struct us
                }
        }

-       /* 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);
+       timeout = wait_for_completion_timeout(&urb_done,
+                                             timeout ? : MAX_SCHEDULE_TIMEOUT);

-       /* clean up the timeout timer */
-       if (timeout > 0)
-               del_timer_sync(&to_timer);
+       if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags) && !timeout) {
+               US_DEBUGP("Timeout -- cancelling URB\n");
+               usb_unlink_urb(us->current_urb);
+       }

        /* return the URB status */
        return us->current_urb->status;
--
1.3.3.g8701


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to