diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-03-05 11:01:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:36 -0400 |
commit | 7ea0a2bcfe40b1c525e63e931b7142ab22b64269 (patch) | |
tree | 90f5853d6a4685a00baf895eafe1098bb8e19f3c /drivers | |
parent | 66760169492445395c530c812443f58e2cfdb3dc (diff) |
USB: uhci: don't use pseudo negative values
The code in uhci-q.c doesn't have to use pseudo-negative values. I did
it that way because it was easy and because it would give the expected
output during debugging. But it doesn't have to work that way. Here's
another approach.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/uhci-debug.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/uhci-q.c | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 20cc58b97807..e52b954dda47 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -118,7 +118,9 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : "")); | 120 | out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : "")); |
121 | out += sprintf(out, " Actlen=%d", urbp->urb->actual_length); | 121 | out += sprintf(out, " Actlen=%d%s", urbp->urb->actual_length, |
122 | (urbp->qh->type == USB_ENDPOINT_XFER_CONTROL ? | ||
123 | "-8" : "")); | ||
122 | 124 | ||
123 | if (urbp->urb->unlinked) | 125 | if (urbp->urb->unlinked) |
124 | out += sprintf(out, " Unlinked=%d", urbp->urb->unlinked); | 126 | out += sprintf(out, " Unlinked=%d", urbp->urb->unlinked); |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index 58f873679145..3e5807d14ffb 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -899,8 +899,6 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb, | |||
899 | } | 899 | } |
900 | if (qh->state != QH_STATE_ACTIVE) | 900 | if (qh->state != QH_STATE_ACTIVE) |
901 | qh->skel = skel; | 901 | qh->skel = skel; |
902 | |||
903 | urb->actual_length = -8; /* Account for the SETUP packet */ | ||
904 | return 0; | 902 | return 0; |
905 | 903 | ||
906 | nomem: | 904 | nomem: |
@@ -1494,11 +1492,10 @@ __acquires(uhci->lock) | |||
1494 | 1492 | ||
1495 | if (qh->type == USB_ENDPOINT_XFER_CONTROL) { | 1493 | if (qh->type == USB_ENDPOINT_XFER_CONTROL) { |
1496 | 1494 | ||
1497 | /* urb->actual_length < 0 means the setup transaction didn't | 1495 | /* Subtract off the length of the SETUP packet from |
1498 | * complete successfully. Either it failed or the URB was | 1496 | * urb->actual_length. |
1499 | * unlinked first. Regardless, don't confuse people with a | 1497 | */ |
1500 | * negative length. */ | 1498 | urb->actual_length -= min_t(u32, 8, urb->actual_length); |
1501 | urb->actual_length = max(urb->actual_length, 0); | ||
1502 | } | 1499 | } |
1503 | 1500 | ||
1504 | /* When giving back the first URB in an Isochronous queue, | 1501 | /* When giving back the first URB in an Isochronous queue, |