diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 11:25:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 11:25:49 -0400 |
commit | 52a23685f37c06d0cd00eeb8f517a90de3f2c338 (patch) | |
tree | 1449bf12db013962c98b2b8cd9b4b5d1cf359b01 /drivers/usb/core/message.c | |
parent | d046943cbaf332f75284ad99f4b3e60bae7ffff2 (diff) | |
parent | d20da3c39b9d5b04f0258ba74643533268f56e30 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (44 commits)
USB: drivers/usb/storage/dpcm.c whitespace cleanup
USB: r8a66597-hcd: fixes some problem
USB: change name of spinlock in hcd.c
USB: move routines in hcd.c
USB: misc: uss720: clean up urb->status usage
USB: misc: usbtest: clean up urb->status usage
USB: misc: usblcd: clean up urb->status usage
USB: misc: phidgetmotorcontrol: clean up urb->status usage
USB: misc: phidgetkit: clean up urb->status usage
USB: misc: legousbtower: clean up urb->status usage
USB: misc: ldusb: clean up urb->status usage
USB: misc: iowarrior: clean up urb->status usage
USB: misc: ftdi-elan: clean up urb->status usage
USB: misc: auerswald: clean up urb->status usage
USB: misc: appledisplay: clean up urb->status usage
USB: misc: adtux: clean up urb->status usage
USB: core: message: clean up urb->status usage
USB: image: microtek: clean up urb->status usage
USB: image: mdc800: clean up urb->status usage
USB: storage: onetouch: clean up urb->status usage
...
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 530e854961ce..25f63f1096b4 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -34,13 +34,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) | |||
34 | { | 34 | { |
35 | struct completion done; | 35 | struct completion done; |
36 | unsigned long expire; | 36 | unsigned long expire; |
37 | int status; | 37 | int retval; |
38 | int status = urb->status; | ||
38 | 39 | ||
39 | init_completion(&done); | 40 | init_completion(&done); |
40 | urb->context = &done; | 41 | urb->context = &done; |
41 | urb->actual_length = 0; | 42 | urb->actual_length = 0; |
42 | status = usb_submit_urb(urb, GFP_NOIO); | 43 | retval = usb_submit_urb(urb, GFP_NOIO); |
43 | if (unlikely(status)) | 44 | if (unlikely(retval)) |
44 | goto out; | 45 | goto out; |
45 | 46 | ||
46 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; | 47 | expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT; |
@@ -55,15 +56,15 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) | |||
55 | urb->transfer_buffer_length); | 56 | urb->transfer_buffer_length); |
56 | 57 | ||
57 | usb_kill_urb(urb); | 58 | usb_kill_urb(urb); |
58 | status = urb->status == -ENOENT ? -ETIMEDOUT : urb->status; | 59 | retval = status == -ENOENT ? -ETIMEDOUT : status; |
59 | } else | 60 | } else |
60 | status = urb->status; | 61 | retval = status; |
61 | out: | 62 | out: |
62 | if (actual_length) | 63 | if (actual_length) |
63 | *actual_length = urb->actual_length; | 64 | *actual_length = urb->actual_length; |
64 | 65 | ||
65 | usb_free_urb(urb); | 66 | usb_free_urb(urb); |
66 | return status; | 67 | return retval; |
67 | } | 68 | } |
68 | 69 | ||
69 | /*-------------------------------------------------------------------*/ | 70 | /*-------------------------------------------------------------------*/ |
@@ -250,6 +251,7 @@ static void sg_clean (struct usb_sg_request *io) | |||
250 | static void sg_complete (struct urb *urb) | 251 | static void sg_complete (struct urb *urb) |
251 | { | 252 | { |
252 | struct usb_sg_request *io = urb->context; | 253 | struct usb_sg_request *io = urb->context; |
254 | int status = urb->status; | ||
253 | 255 | ||
254 | spin_lock (&io->lock); | 256 | spin_lock (&io->lock); |
255 | 257 | ||
@@ -265,21 +267,21 @@ static void sg_complete (struct urb *urb) | |||
265 | */ | 267 | */ |
266 | if (io->status | 268 | if (io->status |
267 | && (io->status != -ECONNRESET | 269 | && (io->status != -ECONNRESET |
268 | || urb->status != -ECONNRESET) | 270 | || status != -ECONNRESET) |
269 | && urb->actual_length) { | 271 | && urb->actual_length) { |
270 | dev_err (io->dev->bus->controller, | 272 | dev_err (io->dev->bus->controller, |
271 | "dev %s ep%d%s scatterlist error %d/%d\n", | 273 | "dev %s ep%d%s scatterlist error %d/%d\n", |
272 | io->dev->devpath, | 274 | io->dev->devpath, |
273 | usb_pipeendpoint (urb->pipe), | 275 | usb_pipeendpoint (urb->pipe), |
274 | usb_pipein (urb->pipe) ? "in" : "out", | 276 | usb_pipein (urb->pipe) ? "in" : "out", |
275 | urb->status, io->status); | 277 | status, io->status); |
276 | // BUG (); | 278 | // BUG (); |
277 | } | 279 | } |
278 | 280 | ||
279 | if (io->status == 0 && urb->status && urb->status != -ECONNRESET) { | 281 | if (io->status == 0 && status && status != -ECONNRESET) { |
280 | int i, found, status; | 282 | int i, found, retval; |
281 | 283 | ||
282 | io->status = urb->status; | 284 | io->status = status; |
283 | 285 | ||
284 | /* the previous urbs, and this one, completed already. | 286 | /* the previous urbs, and this one, completed already. |
285 | * unlink pending urbs so they won't rx/tx bad data. | 287 | * unlink pending urbs so they won't rx/tx bad data. |
@@ -290,13 +292,13 @@ static void sg_complete (struct urb *urb) | |||
290 | if (!io->urbs [i] || !io->urbs [i]->dev) | 292 | if (!io->urbs [i] || !io->urbs [i]->dev) |
291 | continue; | 293 | continue; |
292 | if (found) { | 294 | if (found) { |
293 | status = usb_unlink_urb (io->urbs [i]); | 295 | retval = usb_unlink_urb (io->urbs [i]); |
294 | if (status != -EINPROGRESS | 296 | if (retval != -EINPROGRESS && |
295 | && status != -ENODEV | 297 | retval != -ENODEV && |
296 | && status != -EBUSY) | 298 | retval != -EBUSY) |
297 | dev_err (&io->dev->dev, | 299 | dev_err (&io->dev->dev, |
298 | "%s, unlink --> %d\n", | 300 | "%s, unlink --> %d\n", |
299 | __FUNCTION__, status); | 301 | __FUNCTION__, retval); |
300 | } else if (urb == io->urbs [i]) | 302 | } else if (urb == io->urbs [i]) |
301 | found = 1; | 303 | found = 1; |
302 | } | 304 | } |