aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ipaq.c
diff options
context:
space:
mode:
authorLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>2006-07-27 09:30:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:51 -0400
commit014aa2a3c32ebe33f97e9d219d91d3c5c7231bf7 (patch)
treeab51798d1a84e0bd91d498d946a1e8b68576d15d /drivers/usb/serial/ipaq.c
parent25d94e682ccb8938177bffafa67a7d21c7282a4a (diff)
USB: ipaq: minor ipaq_open() cleanup.
Commit b512504e5671f83638be0ddr085c4b1832f623d3 made ipaq_open() a bit messy by moving the read urb submission far from its usb_fill_bulk_urb() call and the comment explaining what it does. This patch put they together again. Although only compiled tested, should not break the fix introduced by b512504e5671f83638be0ddr085c4b1832f623d3, of course. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ipaq.c')
-rw-r--r--drivers/usb/serial/ipaq.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 9840bade79f9..bfc6998cd16f 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -652,11 +652,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
652 port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; 652 port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
653 653
654 msleep(1000*initial_wait); 654 msleep(1000*initial_wait);
655 /* Start reading from the device */
656 usb_fill_bulk_urb(port->read_urb, serial->dev,
657 usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
658 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
659 ipaq_read_bulk_callback, port);
660 655
661 /* 656 /*
662 * Send out control message observed in win98 sniffs. Not sure what 657 * Send out control message observed in win98 sniffs. Not sure what
@@ -670,18 +665,31 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
670 result = usb_control_msg(serial->dev, 665 result = usb_control_msg(serial->dev,
671 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 666 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
672 0x1, 0, NULL, 0, 100); 667 0x1, 0, NULL, 0, 100);
673 if (result == 0) { 668 if (!result)
674 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 669 break;
675 if (result) { 670
676 err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
677 goto error;
678 }
679 return 0;
680 }
681 msleep(1000); 671 msleep(1000);
682 } 672 }
683 err("%s - failed doing control urb, error %d", __FUNCTION__, result); 673
684 goto error; 674 if (!retries && result) {
675 err("%s - failed doing control urb, error %d", __FUNCTION__,
676 result);
677 goto error;
678 }
679
680 /* Start reading from the device */
681 usb_fill_bulk_urb(port->read_urb, serial->dev,
682 usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
683 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
684 ipaq_read_bulk_callback, port);
685
686 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
687 if (result) {
688 err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
689 goto error;
690 }
691
692 return 0;
685 693
686enomem: 694enomem:
687 result = -ENOMEM; 695 result = -ENOMEM;