| From: |
| Greg KH <greg@kroah.com> |
| To: |
| linux-usb-devel@lists.sourceforge.net |
| Subject: |
| [RFC] deleting urb->status |
| Date: |
| Thu, 24 Mar 2005 00:19:29 -0800 |
| Archive-link: |
| Article,
Thread
|
Hi all,
The .status field of the struct urb is routinely used improperly by
drivers to try to see if the urb is still in flight or not (and yes, I
know that I wrote some of those drivers, that's why I'm proposing
this...) I'd like to just drop that field completely, and replace it by
changing the urb callback function to contain a status variable instead.
As an example, the following fragment of a patch to the pl2303 driver
would be what is needed to change for most USB drivers:
--- 1.111/drivers/usb/serial/pl2303.c 2004-11-22 10:42:02 -08:00
+++ edited/pl2303.c 2005-03-24 00:15:24 -08:00
@@ -942,7 +942,7 @@ static void pl2303_read_bulk_callback (s
-static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs
*regs)
+static void pl2303_write_bulk_callback (struct urb *urb, int status, struct pt_regs
*regs)
{
struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct pl2303_private *priv = usb_get_serial_port_data(port);
@@ -950,7 +950,7 @@ static void pl2303_write_bulk_callback (
dbg("%s - port %d", __FUNCTION__, port->number);
- switch (urb->status) {
+ switch (status) {
case 0:
/* success */
break;
@@ -958,13 +958,13 @@ static void pl2303_write_bulk_callback (
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
- dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
+ dbg("%s - urb shutting down with status: %d", __FUNCTION__, status);
priv->write_urb_in_use = 0;
return;
default:
/* error in the urb, so we have to resubmit it */
dbg("%s - Overflow in write", __FUNCTION__);
- dbg("%s - nonzero write bulk status received: %d", __FUNCTION__,
urb->status);
+ dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status);
port->write_urb->transfer_buffer_length = 1;
port->write_urb->dev = port->serial->dev;
result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
Now yes, I do realise this is going to require changing every urb
callback function, but hey, I'm the one volunteering to do this, not you
:)
Anyway, any big objections to this? As I change everything, I'll also
fixup the drivers that improperly use this field.
The HCD drivers will need to bigest changes, as they will have to put
the status value in a hcd specific location, but that's not a big deal,
right?
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content. Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op...
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel