Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 014aa2a3 authored by Luiz Fernando N. Capitulino's avatar Luiz Fernando N. Capitulino Committed by Greg Kroah-Hartman
Browse files

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: default avatarLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 25d94e68
Loading
Loading
Loading
Loading
+23 −15
Original line number Original line Diff line number Diff line
@@ -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;
	port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
	
	
	msleep(1000*initial_wait);
	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
	 * 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,
		result = usb_control_msg(serial->dev,
				usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
				usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
				0x1, 0, NULL, 0, 100);
				0x1, 0, NULL, 0, 100);
		if (result == 0) {
		if (!result)
			break;

		msleep(1000);
	}

	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);
	result = usb_submit_urb(port->read_urb, GFP_KERNEL);
	if (result) {
	if (result) {
		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
		goto error;
		goto error;
	}
	}

	return 0;
	return 0;
		}
		msleep(1000);
	}
	err("%s - failed doing control urb, error %d", __FUNCTION__, result);
	goto error;


enomem:
enomem:
	result = -ENOMEM;
	result = -ENOMEM;