Hi,
Here's a patch against 2.5.1-pre7 that removes the USB_ST_* error codes
from the drivers that use them, and replaces them with the proper kernel
error codes.
thanks,
greg k-h
diff -Nru a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt
--- a/Documentation/usb/error-codes.txt Fri Dec 7 21:30:07 2001
+++ b/Documentation/usb/error-codes.txt Fri Dec 7 21:30:07 2001
@@ -1,14 +1,9 @@
-Revised: 2000-Dec-05.
+Revised: 2001-Dec-06.
This is the documentation of (hopefully) all possible error codes (and
their interpretation) that can be returned from the host controller drivers
and from usbcore.
-NOTE:
-The USB_ST_* codes are deprecated and are only listed for compatibility;
-new software should use only -E* instead!
-
-
**************************************************************************
* Error codes returned by usb_submit_urb *
@@ -16,7 +11,6 @@
Non-USB-specific:
-USB_ST_NOERROR
0 URB submission went fine
-ENOMEM no memory for allocation of internal structures
@@ -25,12 +19,10 @@
-ENODEV specified USB-device or bus doesn't exist
-USB_ST_REQUEST_ERROR
-ENXIO a control or interrupt URB is already queued to this endpoint; or
a bulk URB is already queued to this endpoint and
USB_QUEUE_BULK wasn't used (UHCI HCDs only)
-USB_ST_URB_INVALID_ERROR
-EINVAL a) Invalid transfer type specified (or not supported)
b) Invalid interrupt interval (0<=n<256)
c) more than one interrupt packet requested
@@ -42,12 +34,10 @@
-EFBIG too much ISO frames requested (currently uhci>900)
-USB_ST_STALL
-EPIPE specified pipe-handle is already stalled
-EMSGSIZE endpoint message size is zero, do interface/alternate setting
-USB_ST_BANDWIDTH_ERROR
-ENOSPC The host controller's bandwidth is already consumed and
this request would push it past its allowed limit.
@@ -60,60 +50,43 @@
* or in iso_frame_desc[n].status (for ISO) *
**************************************************************************
-USB_ST_NOERROR
0 Transfer completed successfully
-USB_ST_URB_KILLED
-ENOENT URB was canceled by usb_unlink_urb
-USB_ST_URB_PENDING
-EINPROGRESS URB still pending, no results yet
(actually no error until now;-)
-USB_ST_BITSTUFF
-USB_ST_INTERNALERROR
-EPROTO a) bitstuff error
b) unknown USB error
-USB_ST_CRC
-EILSEQ CRC mismatch
-USB_ST_STALL
-EPIPE endpoint stalled
-USB_ST_BUFFEROVERRUN
-ECOMM During an IN transfer, the host controller
received data from an endpoint faster than it
could be written to system memory
-USB_ST_BUFFERUNDERRUN
-ENOSR During an OUT transfer, the host controller
could not retrieve data from system memory fast
enough to keep up with the USB data rate
-USB_ST_DATAOVERRUN
-EOVERFLOW The amount of data returned by the endpoint was
greater than either the max packet size of the
endpoint or the remaining buffer size. "Babble".
-USB_ST_DATAUNDERRUN
-EREMOTEIO The endpoint returned less than max packet size
and that amount did not fill the specified buffer
-USB_ST_NORESPONSE
-USB_ST_TIMEOUT
-ETIMEDOUT transfer timed out, NAK
-USB_ST_REMOVED
-ENODEV device was removed
-USB_ST_SHORT_PACKET
-EREMOTEIO short packet detected
-USB_ST_PARTIAL_ERROR
-EXDEV ISO transfer only partially completed
look at individual frame status for details
-USB_ST_URB_INVALID_ERROR
-EINVAL ISO madness, if this happens: Log off and go home
-ECONNRESET the URB is being unlinked asynchronously
diff -Nru a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c
--- a/drivers/isdn/hisax/st5481_b.c Fri Dec 7 21:30:07 2001
+++ b/drivers/isdn/hisax/st5481_b.c Fri Dec 7 21:30:07 2001
@@ -168,7 +168,7 @@
test_and_clear_bit(buf_nr, &b_out->busy);
if (urb->status < 0) {
- if (urb->status != USB_ST_URB_KILLED) {
+ if (urb->status != -ENOENT) {
WARN("urb status %d",urb->status);
if (b_out->busy == 0) {
st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 |
USB_DIR_OUT, NULL, NULL);
diff -Nru a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c
--- a/drivers/isdn/hisax/st5481_d.c Fri Dec 7 21:30:06 2001
+++ b/drivers/isdn/hisax/st5481_d.c Fri Dec 7 21:30:06 2001
@@ -382,7 +382,7 @@
test_and_clear_bit(buf_nr, &d_out->busy);
if (urb->status < 0) {
- if (urb->status != USB_ST_URB_KILLED) {
+ if (urb->status != -ENOENT) {
WARN("urb status %d",urb->status);
if (d_out->busy == 0) {
st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT,
fifo_reseted, adapter);
diff -Nru a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
--- a/drivers/isdn/hisax/st5481_usb.c Fri Dec 7 21:30:06 2001
+++ b/drivers/isdn/hisax/st5481_usb.c Fri Dec 7 21:30:06 2001
@@ -130,7 +130,7 @@
struct ctrl_msg *ctrl_msg;
if (urb->status < 0) {
- if (urb->status != USB_ST_URB_KILLED) {
+ if (urb->status != -ENOENT) {
WARN("urb status %d",urb->status);
} else {
DBG(1,"urb killed");
@@ -184,7 +184,7 @@
int j;
if (urb->status < 0) {
- if (urb->status != USB_ST_URB_KILLED) {
+ if (urb->status != -ENOENT) {
WARN("urb status %d",urb->status);
urb->actual_length = 0;
} else {
@@ -470,7 +470,7 @@
int len, count, status;
if (urb->status < 0) {
- if (urb->status != USB_ST_URB_KILLED) {
+ if (urb->status != -ENOENT) {
WARN("urb status %d",urb->status);
} else {
DBG(1,"urb killed");
diff -Nru a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
--- a/drivers/net/irda/irda-usb.c Fri Dec 7 21:30:07 2001
+++ b/drivers/net/irda/irda-usb.c Fri Dec 7 21:30:07 2001
@@ -256,7 +256,7 @@
/* Grab the speed URB */
purb = &self->speed_urb;
- if (purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
WARNING(__FUNCTION__ "(), URB still in use!\n");
return;
}
@@ -301,7 +301,7 @@
}
/* Check for timeout and other USB nasties */
- if(purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
/* I get a lot of -ECONNABORTED = -103 here - Jean II */
IRDA_DEBUG(0, __FUNCTION__ "(), URB complete status %d, transfer_flags
0x%04X\n", purb->status, purb->transfer_flags);
@@ -314,7 +314,7 @@
}
/* urb is now available */
- purb->status = USB_ST_NOERROR;
+ purb->status = 0;
/* If it was the speed URB, allow the stack to send more packets */
if(purb == &self->speed_urb) {
@@ -372,7 +372,7 @@
}
}
- if (purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
WARNING(__FUNCTION__ "(), URB still in use!\n");
dev_kfree_skb(skb);
return 0;
@@ -490,7 +490,7 @@
purb->context = NULL;
/* Check for timeout and other USB nasties */
- if(purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
/* I get a lot of -ECONNABORTED = -103 here - Jean II */
IRDA_DEBUG(0, __FUNCTION__ "(), URB complete status %d, transfer_flags
0x%04X\n", purb->status, purb->transfer_flags);
@@ -504,7 +504,7 @@
}
/* urb is now available */
- purb->status = USB_ST_NOERROR;
+ purb->status = 0;
/* If the network is closed, stop everything */
if ((!self->netopen) || (!self->present)) {
@@ -547,11 +547,11 @@
/* Check speed URB */
purb = &(self->speed_urb);
- if (purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
IRDA_DEBUG(0, "%s: Speed change timed out, urb->status=%d,
urb->transfer_flags=0x%04X\n", netdev->name, purb->status, purb->transfer_flags);
switch (purb->status) {
- case USB_ST_URB_PENDING: /* -EINPROGRESS == -115 */
+ case -EINPROGRESS:
usb_unlink_urb(purb);
/* Note : above will *NOT* call netif_wake_queue()
* in completion handler, we will come back here.
@@ -563,7 +563,7 @@
case -ETIMEDOUT: /* -110 */
case -ENOENT: /* -2 (urb unlinked by us) */
default: /* ??? - Play safe */
- purb->status = USB_ST_NOERROR;
+ purb->status = 0;
netif_wake_queue(self->netdev);
done = 1;
break;
@@ -572,7 +572,7 @@
/* Check Tx URB */
purb = &(self->tx_urb);
- if (purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
struct sk_buff *skb = purb->context;
IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d,
urb->transfer_flags=0x%04X\n", netdev->name, purb->status, purb->transfer_flags);
@@ -590,7 +590,7 @@
#endif /* IU_BUG_KICK_TIMEOUT */
switch (purb->status) {
- case USB_ST_URB_PENDING: /* -EINPROGRESS == -115 */
+ case -EINPROGRESS:
usb_unlink_urb(purb);
/* Note : above will *NOT* call netif_wake_queue()
* in completion handler, because purb->status will
@@ -610,7 +610,7 @@
dev_kfree_skb_any(skb);
purb->context = NULL;
}
- purb->status = USB_ST_NOERROR;
+ purb->status = 0;
netif_wake_queue(self->netdev);
done = 1;
break;
@@ -727,7 +727,7 @@
purb->transfer_flags = USB_QUEUE_BULK;
/* Note : unlink *must* be synchronous because of the code in
* irda_usb_net_close() -> free the skb - Jean II */
- purb->status = USB_ST_NOERROR;
+ purb->status = 0;
purb->next = NULL; /* Don't auto resubmit URBs */
ret = usb_submit_urb(purb);
@@ -768,9 +768,9 @@
}
/* Check the status */
- if(purb->status != USB_ST_NOERROR) {
+ if (purb->status != 0) {
switch (purb->status) {
- case USB_ST_CRC: /* -EILSEQ */
+ case -EILSEQ:
self->stats.rx_errors++;
self->stats.rx_crc_errors++;
break;
@@ -1442,9 +1442,9 @@
ret = usb_set_interface(dev, ifnum, 0);
IRDA_DEBUG(1, "usb-irda: set interface %d result %d\n", ifnum, ret);
switch (ret) {
- case USB_ST_NOERROR: /* 0 */
+ case 0:
break;
- case USB_ST_STALL: /* -EPIPE = -32 */
+ case -EPIPE: /* -EPIPE = -32 */
usb_clear_halt(dev, usb_sndctrlpipe(dev, 0));
IRDA_DEBUG(0, __FUNCTION__ "(), Clearing stall on control
interface\n" );
break;
diff -Nru a/drivers/usb/dc2xx.c b/drivers/usb/dc2xx.c
--- a/drivers/usb/dc2xx.c Fri Dec 7 21:30:07 2001
+++ b/drivers/usb/dc2xx.c Fri Dec 7 21:30:07 2001
@@ -199,7 +199,7 @@
retval = count;
break;
}
- if (retval != USB_ST_TIMEOUT)
+ if (retval != -ETIMEDOUT)
break;
interruptible_sleep_on_timeout (&camera->wait, RETRY_TIMEOUT);
@@ -267,7 +267,7 @@
} else if (!result)
break;
- if (result == USB_ST_TIMEOUT) { /* NAK - delay a bit */
+ if (result == -ETIMEDOUT) { /* NAK - delay a bit */
if (!maxretry--) {
if (!bytes_written)
bytes_written = -ETIME;
diff -Nru a/drivers/usb/rio500.c b/drivers/usb/rio500.c
--- a/drivers/usb/rio500.c Fri Dec 7 21:30:07 2001
+++ b/drivers/usb/rio500.c Fri Dec 7 21:30:07 2001
@@ -324,7 +324,7 @@
dbg("write stats: result:%d thistime:%lu partial:%u",
result, thistime, partial);
- if (result == USB_ST_TIMEOUT) { /* NAK - so hold for a while */
+ if (result == -ETIMEDOUT) { /* NAK - so hold for a while */
if (!maxretry--) {
errn = -ETIME;
goto error;
@@ -403,7 +403,7 @@
if (partial) {
count = this_read = partial;
- } else if (result == USB_ST_TIMEOUT || result == 15) { /* FIXME: 15
??? */
+ } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15
+??? */
if (!maxretry--) {
up(&(rio->lock));
err("read_rio: maxretry timeout");
@@ -412,7 +412,7 @@
interruptible_sleep_on_timeout(&rio->wait_q,
NAK_TIMEOUT);
continue;
- } else if (result != USB_ST_DATAUNDERRUN) {
+ } else if (result != -EREMOTEIO) {
up(&(rio->lock));
err("Read Whoops - result:%u partial:%u this_read:%u",
result, partial, this_read);
diff -Nru a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c
--- a/drivers/usb/usb-ohci.c Fri Dec 7 21:30:07 2001
+++ b/drivers/usb/usb-ohci.c Fri Dec 7 21:30:07 2001
@@ -485,7 +485,7 @@
/* implicitly requeued */
urb->actual_length = 0;
- urb->status = USB_ST_URB_PENDING;
+ urb->status = -EINPROGRESS;
if (urb_priv->state != URB_DEL)
td_submit_urb (urb);
break;
@@ -502,7 +502,7 @@
urb->complete (urb);
spin_lock_irqsave (&usb_ed_lock, flags);
urb->actual_length = 0;
- urb->status = USB_ST_URB_PENDING;
+ urb->status = -EINPROGRESS;
urb->start_frame = urb_priv->ed->last_iso + 1;
if (urb_priv->state != URB_DEL) {
for (i = 0; i < urb->number_of_packets; i++) {
@@ -673,7 +673,7 @@
urb->actual_length = 0;
urb->hcpriv = urb_priv;
- urb->status = USB_ST_URB_PENDING;
+ urb->status = -EINPROGRESS;
/* link the ed into a chain if is not already */
if (ed->state != ED_OPER)
@@ -737,7 +737,7 @@
if (usb_pipedevice (urb->pipe) == ohci->rh.devnum)
return rh_unlink_urb (urb);
- if (urb->hcpriv && (urb->status == USB_ST_URB_PENDING)) {
+ if (urb->hcpriv && (urb->status == -EINPROGRESS)) {
if (!ohci->disabled) {
urb_priv_t * urb_priv;
@@ -777,11 +777,11 @@
/* wait until all TDs are deleted */
set_current_state(TASK_UNINTERRUPTIBLE);
- while (timeout && (urb->status == USB_ST_URB_PENDING))
+ while (timeout && (urb->status == -EINPROGRESS))
timeout = schedule_timeout (timeout);
set_current_state(TASK_RUNNING);
remove_wait_queue (&unlink_wakeup, &wait);
- if (urb->status == USB_ST_URB_PENDING) {
+ if (urb->status == -EINPROGRESS) {
err ("unlink URB timeout");
return -ETIMEDOUT;
}
diff -Nru a/drivers/usb/usb-ohci.h b/drivers/usb/usb-ohci.h
--- a/drivers/usb/usb-ohci.h Fri Dec 7 21:30:07 2001
+++ b/drivers/usb/usb-ohci.h Fri Dec 7 21:30:07 2001
@@ -11,22 +11,22 @@
static int cc_to_error[16] = {
/* mapping of the OHCI CC status to error codes */
- /* No Error */ USB_ST_NOERROR,
- /* CRC Error */ USB_ST_CRC,
- /* Bit Stuff */ USB_ST_BITSTUFF,
- /* Data Togg */ USB_ST_CRC,
- /* Stall */ USB_ST_STALL,
- /* DevNotResp */ USB_ST_NORESPONSE,
- /* PIDCheck */ USB_ST_BITSTUFF,
- /* UnExpPID */ USB_ST_BITSTUFF,
- /* DataOver */ USB_ST_DATAOVERRUN,
- /* DataUnder */ USB_ST_DATAUNDERRUN,
- /* reservd */ USB_ST_NORESPONSE,
- /* reservd */ USB_ST_NORESPONSE,
- /* BufferOver */ USB_ST_BUFFEROVERRUN,
- /* BuffUnder */ USB_ST_BUFFERUNDERRUN,
- /* Not Access */ USB_ST_NORESPONSE,
- /* Not Access */ USB_ST_NORESPONSE
+ /* No Error */ 0,
+ /* CRC Error */ -EILSEQ,
+ /* Bit Stuff */ -EPROTO,
+ /* Data Togg */ -EILSEQ,
+ /* Stall */ -EPIPE,
+ /* DevNotResp */ -ETIMEDOUT,
+ /* PIDCheck */ -EPROTO,
+ /* UnExpPID */ -EPROTO,
+ /* DataOver */ -EOVERFLOW,
+ /* DataUnder */ -EREMOTEIO,
+ /* reservd */ -ETIMEDOUT,
+ /* reservd */ -ETIMEDOUT,
+ /* BufferOver */ -ECOMM,
+ /* BuffUnder */ -ENOSR,
+ /* Not Access */ -ETIMEDOUT,
+ /* Not Access */ -ETIMEDOUT
};
#include <linux/config.h>
diff -Nru a/drivers/usb/uss720.c b/drivers/usb/uss720.c
--- a/drivers/usb/uss720.c Fri Dec 7 21:30:08 2001
+++ b/drivers/usb/uss720.c Fri Dec 7 21:30:08 2001
@@ -193,7 +193,7 @@
struct parport *pp = (struct parport *)dev_id;
struct parport_uss720_private *priv = pp->private_data;
- if (usbstatus != USB_ST_NOERROR || len < 4 || !buffer)
+ if (usbstatus != 0 || len < 4 || !buffer)
return 1;
memcpy(priv->reg, buffer, 4);
/* if nAck interrupts are enabled and we have an interrupt, call the interrupt
procedure */
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel