The while-loop seemed excessively blocked with
conditionals. By reorganizing the code so timeout is the condition for
the loop and changing the checks within the loop, several lines of code
were removed.

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>
---


 kj-domen/drivers/usb/class/usblp.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff -puN drivers/usb/class/usblp.c~schedule_cleanup-drivers_usb_class_usblp.c 
drivers/usb/class/usblp.c
--- kj/drivers/usb/class/usblp.c~schedule_cleanup-drivers_usb_class_usblp.c     
2005-03-05 16:10:01.000000000 +0100
+++ kj-domen/drivers/usb/class/usblp.c  2005-03-05 16:10:01.000000000 +0100
@@ -637,19 +637,17 @@ static ssize_t usblp_write(struct file *
 
                        timeout = USBLP_WRITE_TIMEOUT;
                        add_wait_queue(&usblp->wait, &wait);
-                       while ( 1==1 ) {
-
+                       while (timeout) {
                                if (signal_pending(current)) {
                                        remove_wait_queue(&usblp->wait, &wait);
                                        return writecount ? writecount : -EINTR;
                                }
                                set_current_state(TASK_INTERRUPTIBLE);
-                               if (timeout && !usblp->wcomplete) {
-                                       timeout = schedule_timeout(timeout);
-                               } else {
+                               if (usblp->wcomplete) {
                                        set_current_state(TASK_RUNNING);
                                        break;
                                }
+                               timeout = schedule_timeout(timeout);
                        }
                        remove_wait_queue(&usblp->wait, &wait);
                }
_


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
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