From 3a6a68746c32d0a64f705a3e6ae72080929185d9 Mon Sep 17 00:00:00 2001 From: "Luiz Fernando N. Capitulino" Date: Thu, 27 Jul 2006 10:30:43 -0300 Subject: [PATCH] --- yaml --- r: 36391 b: refs/heads/master c: 014aa2a3c32ebe33f97e9d219d91d3c5c7231bf7 h: refs/heads/master i: 36389: 06352073e3c209064a4844eb8cc4dc7bcbd05a58 36387: 1d24b0c9fc317c8b16715cacb07b12502214e93c 36383: d457c67c941546cb459bf0d08ed9ec70cf77e21d v: v3 --- [refs] | 2 +- trunk/drivers/usb/serial/ipaq.c | 38 ++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index a76973c645b3..c80ceba3d401 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 25d94e682ccb8938177bffafa67a7d21c7282a4a +refs/heads/master: 014aa2a3c32ebe33f97e9d219d91d3c5c7231bf7 diff --git a/trunk/drivers/usb/serial/ipaq.c b/trunk/drivers/usb/serial/ipaq.c index 9840bade79f9..bfc6998cd16f 100644 --- a/trunk/drivers/usb/serial/ipaq.c +++ b/trunk/drivers/usb/serial/ipaq.c @@ -652,11 +652,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; msleep(1000*initial_wait); - /* Start reading from the device */ - usb_fill_bulk_urb(port->read_urb, serial->dev, - usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), - port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, - ipaq_read_bulk_callback, port); /* * 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) result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 0x1, 0, NULL, 0, 100); - if (result == 0) { - result = usb_submit_urb(port->read_urb, GFP_KERNEL); - if (result) { - err("%s - failed submitting read urb, error %d", __FUNCTION__, result); - goto error; - } - return 0; - } + if (!result) + break; + msleep(1000); } - err("%s - failed doing control urb, error %d", __FUNCTION__, result); - goto error; + + if (!retries && result) { + err("%s - failed doing control urb, error %d", __FUNCTION__, + result); + goto error; + } + + /* Start reading from the device */ + usb_fill_bulk_urb(port->read_urb, serial->dev, + usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), + port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, + ipaq_read_bulk_callback, port); + + result = usb_submit_urb(port->read_urb, GFP_KERNEL); + if (result) { + err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + goto error; + } + + return 0; enomem: result = -ENOMEM;