mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
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>
This commit is contained in:
parent
6676016949
commit
7ea0a2bcfe
2 changed files with 7 additions and 8 deletions
|
@ -118,7 +118,9 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : ""));
|
out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : ""));
|
||||||
out += sprintf(out, " Actlen=%d", urbp->urb->actual_length);
|
out += sprintf(out, " Actlen=%d%s", urbp->urb->actual_length,
|
||||||
|
(urbp->qh->type == USB_ENDPOINT_XFER_CONTROL ?
|
||||||
|
"-8" : ""));
|
||||||
|
|
||||||
if (urbp->urb->unlinked)
|
if (urbp->urb->unlinked)
|
||||||
out += sprintf(out, " Unlinked=%d", urbp->urb->unlinked);
|
out += sprintf(out, " Unlinked=%d", urbp->urb->unlinked);
|
||||||
|
|
|
@ -899,8 +899,6 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
|
||||||
}
|
}
|
||||||
if (qh->state != QH_STATE_ACTIVE)
|
if (qh->state != QH_STATE_ACTIVE)
|
||||||
qh->skel = skel;
|
qh->skel = skel;
|
||||||
|
|
||||||
urb->actual_length = -8; /* Account for the SETUP packet */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nomem:
|
nomem:
|
||||||
|
@ -1494,11 +1492,10 @@ __acquires(uhci->lock)
|
||||||
|
|
||||||
if (qh->type == USB_ENDPOINT_XFER_CONTROL) {
|
if (qh->type == USB_ENDPOINT_XFER_CONTROL) {
|
||||||
|
|
||||||
/* urb->actual_length < 0 means the setup transaction didn't
|
/* Subtract off the length of the SETUP packet from
|
||||||
* complete successfully. Either it failed or the URB was
|
* urb->actual_length.
|
||||||
* unlinked first. Regardless, don't confuse people with a
|
*/
|
||||||
* negative length. */
|
urb->actual_length -= min_t(u32, 8, urb->actual_length);
|
||||||
urb->actual_length = max(urb->actual_length, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When giving back the first URB in an Isochronous queue,
|
/* When giving back the first URB in an Isochronous queue,
|
||||||
|
|
Loading…
Reference in a new issue