diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-18 13:58:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-19 20:46:06 -0400 |
commit | dd6fa4d755fb1e2822406ab8ce3d28db217acc01 (patch) | |
tree | ffad3fe44a90a30d6298fc4870bbd21ffc9140f9 /drivers | |
parent | 62e5a330dc1354d98f73a82f3d13517805f061f6 (diff) |
USB: image: mdc800: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/image/mdc800.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c index 36502a06f73a..d1131a87a5b1 100644 --- a/drivers/usb/image/mdc800.c +++ b/drivers/usb/image/mdc800.c | |||
@@ -284,9 +284,9 @@ static void mdc800_usb_irq (struct urb *urb) | |||
284 | int data_received=0, wake_up; | 284 | int data_received=0, wake_up; |
285 | unsigned char* b=urb->transfer_buffer; | 285 | unsigned char* b=urb->transfer_buffer; |
286 | struct mdc800_data* mdc800=urb->context; | 286 | struct mdc800_data* mdc800=urb->context; |
287 | int status = urb->status; | ||
287 | 288 | ||
288 | if (urb->status >= 0) | 289 | if (status >= 0) { |
289 | { | ||
290 | 290 | ||
291 | //dbg ("%i %i %i %i %i %i %i %i \n",b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]); | 291 | //dbg ("%i %i %i %i %i %i %i %i \n",b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]); |
292 | 292 | ||
@@ -324,7 +324,7 @@ static void mdc800_usb_irq (struct urb *urb) | |||
324 | || | 324 | || |
325 | ((mdc800->camera_request_ready == 3) && (mdc800->camera_busy)) | 325 | ((mdc800->camera_request_ready == 3) && (mdc800->camera_busy)) |
326 | || | 326 | || |
327 | (urb->status < 0) | 327 | (status < 0) |
328 | ); | 328 | ); |
329 | 329 | ||
330 | if (wake_up) | 330 | if (wake_up) |
@@ -376,15 +376,12 @@ static int mdc800_usb_waitForIRQ (int mode, int msec) | |||
376 | static void mdc800_usb_write_notify (struct urb *urb) | 376 | static void mdc800_usb_write_notify (struct urb *urb) |
377 | { | 377 | { |
378 | struct mdc800_data* mdc800=urb->context; | 378 | struct mdc800_data* mdc800=urb->context; |
379 | int status = urb->status; | ||
379 | 380 | ||
380 | if (urb->status != 0) | 381 | if (status != 0) |
381 | { | 382 | err ("writing command fails (status=%i)", status); |
382 | err ("writing command fails (status=%i)", urb->status); | ||
383 | } | ||
384 | else | 383 | else |
385 | { | ||
386 | mdc800->state=READY; | 384 | mdc800->state=READY; |
387 | } | ||
388 | mdc800->written = 1; | 385 | mdc800->written = 1; |
389 | wake_up (&mdc800->write_wait); | 386 | wake_up (&mdc800->write_wait); |
390 | } | 387 | } |
@@ -396,9 +393,9 @@ static void mdc800_usb_write_notify (struct urb *urb) | |||
396 | static void mdc800_usb_download_notify (struct urb *urb) | 393 | static void mdc800_usb_download_notify (struct urb *urb) |
397 | { | 394 | { |
398 | struct mdc800_data* mdc800=urb->context; | 395 | struct mdc800_data* mdc800=urb->context; |
396 | int status = urb->status; | ||
399 | 397 | ||
400 | if (urb->status == 0) | 398 | if (status == 0) { |
401 | { | ||
402 | /* Fill output buffer with these data */ | 399 | /* Fill output buffer with these data */ |
403 | memcpy (mdc800->out, urb->transfer_buffer, 64); | 400 | memcpy (mdc800->out, urb->transfer_buffer, 64); |
404 | mdc800->out_count=64; | 401 | mdc800->out_count=64; |
@@ -408,10 +405,8 @@ static void mdc800_usb_download_notify (struct urb *urb) | |||
408 | { | 405 | { |
409 | mdc800->state=READY; | 406 | mdc800->state=READY; |
410 | } | 407 | } |
411 | } | 408 | } else { |
412 | else | 409 | err ("request bytes fails (status:%i)", status); |
413 | { | ||
414 | err ("request bytes fails (status:%i)", urb->status); | ||
415 | } | 410 | } |
416 | mdc800->downloaded = 1; | 411 | mdc800->downloaded = 1; |
417 | wake_up (&mdc800->download_wait); | 412 | wake_up (&mdc800->download_wait); |
@@ -649,9 +644,9 @@ static int mdc800_device_open (struct inode* inode, struct file *file) | |||
649 | 644 | ||
650 | retval=0; | 645 | retval=0; |
651 | mdc800->irq_urb->dev = mdc800->dev; | 646 | mdc800->irq_urb->dev = mdc800->dev; |
652 | if (usb_submit_urb (mdc800->irq_urb, GFP_KERNEL)) | 647 | retval = usb_submit_urb (mdc800->irq_urb, GFP_KERNEL); |
653 | { | 648 | if (retval) { |
654 | err ("request USB irq fails (submit_retval=%i urb_status=%i).",retval, mdc800->irq_urb->status); | 649 | err ("request USB irq fails (submit_retval=%i).", retval); |
655 | errn = -EIO; | 650 | errn = -EIO; |
656 | goto error_out; | 651 | goto error_out; |
657 | } | 652 | } |
@@ -698,6 +693,7 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l | |||
698 | { | 693 | { |
699 | size_t left=len, sts=len; /* single transfer size */ | 694 | size_t left=len, sts=len; /* single transfer size */ |
700 | char __user *ptr = buf; | 695 | char __user *ptr = buf; |
696 | int retval; | ||
701 | 697 | ||
702 | mutex_lock(&mdc800->io_lock); | 698 | mutex_lock(&mdc800->io_lock); |
703 | if (mdc800->state == NOT_CONNECTED) | 699 | if (mdc800->state == NOT_CONNECTED) |
@@ -737,9 +733,9 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l | |||
737 | 733 | ||
738 | /* Download -> Request new bytes */ | 734 | /* Download -> Request new bytes */ |
739 | mdc800->download_urb->dev = mdc800->dev; | 735 | mdc800->download_urb->dev = mdc800->dev; |
740 | if (usb_submit_urb (mdc800->download_urb, GFP_KERNEL)) | 736 | retval = usb_submit_urb (mdc800->download_urb, GFP_KERNEL); |
741 | { | 737 | if (retval) { |
742 | err ("Can't submit download urb (status=%i)",mdc800->download_urb->status); | 738 | err ("Can't submit download urb (retval=%i)",retval); |
743 | mutex_unlock(&mdc800->io_lock); | 739 | mutex_unlock(&mdc800->io_lock); |
744 | return len-left; | 740 | return len-left; |
745 | } | 741 | } |
@@ -788,6 +784,7 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l | |||
788 | static ssize_t mdc800_device_write (struct file *file, const char __user *buf, size_t len, loff_t *pos) | 784 | static ssize_t mdc800_device_write (struct file *file, const char __user *buf, size_t len, loff_t *pos) |
789 | { | 785 | { |
790 | size_t i=0; | 786 | size_t i=0; |
787 | int retval; | ||
791 | 788 | ||
792 | mutex_lock(&mdc800->io_lock); | 789 | mutex_lock(&mdc800->io_lock); |
793 | if (mdc800->state != READY) | 790 | if (mdc800->state != READY) |
@@ -854,9 +851,9 @@ static ssize_t mdc800_device_write (struct file *file, const char __user *buf, s | |||
854 | mdc800->state=WORKING; | 851 | mdc800->state=WORKING; |
855 | memcpy (mdc800->write_urb->transfer_buffer, mdc800->in,8); | 852 | memcpy (mdc800->write_urb->transfer_buffer, mdc800->in,8); |
856 | mdc800->write_urb->dev = mdc800->dev; | 853 | mdc800->write_urb->dev = mdc800->dev; |
857 | if (usb_submit_urb (mdc800->write_urb, GFP_KERNEL)) | 854 | retval = usb_submit_urb (mdc800->write_urb, GFP_KERNEL); |
858 | { | 855 | if (retval) { |
859 | err ("submitting write urb fails (status=%i)", mdc800->write_urb->status); | 856 | err ("submitting write urb fails (retval=%i)", retval); |
860 | mutex_unlock(&mdc800->io_lock); | 857 | mutex_unlock(&mdc800->io_lock); |
861 | return -EIO; | 858 | return -EIO; |
862 | } | 859 | } |