Skip to content

Commit 014aa2a

Browse files
Luiz Fernando N. Capitulinogregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 25d94e6 commit 014aa2a

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

drivers/usb/serial/ipaq.c

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
652652
port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
653653

654654
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);
660655

661656
/*
662657
* 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)
670665
result = usb_control_msg(serial->dev,
671666
usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
672667
0x1, 0, NULL, 0, 100);
673-
if (result == 0) {
674-
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
675-
if (result) {
676-
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
677-
goto error;
678-
}
679-
return 0;
680-
}
668+
if (!result)
669+
break;
670+
681671
msleep(1000);
682672
}
683-
err("%s - failed doing control urb, error %d", __FUNCTION__, result);
684-
goto error;
673+
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;
685693

686694
enomem:
687695
result = -ENOMEM;

0 commit comments

Comments
 (0)