diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2006-05-05 16:26:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:10 -0400 |
commit | 4de7d2c231a8624a47417977be0768c5b5257c4f (patch) | |
tree | 3dba388c3c8e0673a5884c900f2b04339dc4708e /drivers/usb/host/uhci-q.c | |
parent | 2d61bde7a0e630e1906e6478b6b2a7aeaaa8f8da (diff) |
[PATCH] USB: UHCI: store the endpoint type in the QH structure
This patch (as675) simplifies uhci-hcd slightly by storing each endpoint's
type in the corresponding Queue Header structure.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/uhci-q.c')
-rw-r--r-- | drivers/usb/host/uhci-q.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index a06d84c19e13..8639e9035931 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -179,10 +179,12 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci, | |||
179 | qh->hep = hep; | 179 | qh->hep = hep; |
180 | qh->udev = udev; | 180 | qh->udev = udev; |
181 | hep->hcpriv = qh; | 181 | hep->hcpriv = qh; |
182 | qh->type = hep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
182 | 183 | ||
183 | } else { /* Skeleton QH */ | 184 | } else { /* Skeleton QH */ |
184 | qh->state = QH_STATE_ACTIVE; | 185 | qh->state = QH_STATE_ACTIVE; |
185 | qh->udev = NULL; | 186 | qh->udev = NULL; |
187 | qh->type = -1; | ||
186 | } | 188 | } |
187 | return qh; | 189 | return qh; |
188 | } | 190 | } |
@@ -217,8 +219,8 @@ static void uhci_save_toggle(struct uhci_qh *qh, struct urb *urb) | |||
217 | qh->element = UHCI_PTR_TERM; | 219 | qh->element = UHCI_PTR_TERM; |
218 | 220 | ||
219 | /* Only bulk and interrupt pipes have to worry about toggles */ | 221 | /* Only bulk and interrupt pipes have to worry about toggles */ |
220 | if (!(usb_pipetype(urb->pipe) == PIPE_BULK || | 222 | if (!(qh->type == USB_ENDPOINT_XFER_BULK || |
221 | usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) | 223 | qh->type == USB_ENDPOINT_XFER_INT)) |
222 | return; | 224 | return; |
223 | 225 | ||
224 | /* Find the first active TD; that's the device's toggle state */ | 226 | /* Find the first active TD; that's the device's toggle state */ |
@@ -1099,14 +1101,14 @@ static int uhci_urb_enqueue(struct usb_hcd *hcd, | |||
1099 | } | 1101 | } |
1100 | urbp->qh = qh; | 1102 | urbp->qh = qh; |
1101 | 1103 | ||
1102 | switch (usb_pipetype(urb->pipe)) { | 1104 | switch (qh->type) { |
1103 | case PIPE_CONTROL: | 1105 | case USB_ENDPOINT_XFER_CONTROL: |
1104 | ret = uhci_submit_control(uhci, urb, qh); | 1106 | ret = uhci_submit_control(uhci, urb, qh); |
1105 | break; | 1107 | break; |
1106 | case PIPE_BULK: | 1108 | case USB_ENDPOINT_XFER_BULK: |
1107 | ret = uhci_submit_bulk(uhci, urb, qh); | 1109 | ret = uhci_submit_bulk(uhci, urb, qh); |
1108 | break; | 1110 | break; |
1109 | case PIPE_INTERRUPT: | 1111 | case USB_ENDPOINT_XFER_INT: |
1110 | if (list_empty(&qh->queue)) { | 1112 | if (list_empty(&qh->queue)) { |
1111 | bustime = usb_check_bandwidth(urb->dev, urb); | 1113 | bustime = usb_check_bandwidth(urb->dev, urb); |
1112 | if (bustime < 0) | 1114 | if (bustime < 0) |
@@ -1125,7 +1127,7 @@ static int uhci_urb_enqueue(struct usb_hcd *hcd, | |||
1125 | ret = uhci_submit_interrupt(uhci, urb, qh); | 1127 | ret = uhci_submit_interrupt(uhci, urb, qh); |
1126 | } | 1128 | } |
1127 | break; | 1129 | break; |
1128 | case PIPE_ISOCHRONOUS: | 1130 | case USB_ENDPOINT_XFER_ISOC: |
1129 | bustime = usb_check_bandwidth(urb->dev, urb); | 1131 | bustime = usb_check_bandwidth(urb->dev, urb); |
1130 | if (bustime < 0) { | 1132 | if (bustime < 0) { |
1131 | ret = bustime; | 1133 | ret = bustime; |
@@ -1175,7 +1177,7 @@ static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) | |||
1175 | goto done; | 1177 | goto done; |
1176 | 1178 | ||
1177 | /* Remove Isochronous TDs from the frame list ASAP */ | 1179 | /* Remove Isochronous TDs from the frame list ASAP */ |
1178 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) | 1180 | if (urbp->qh->type == USB_ENDPOINT_XFER_ISOC) |
1179 | uhci_unlink_isochronous_tds(uhci, urb); | 1181 | uhci_unlink_isochronous_tds(uhci, urb); |
1180 | uhci_unlink_qh(uhci, urbp->qh); | 1182 | uhci_unlink_qh(uhci, urbp->qh); |
1181 | 1183 | ||
@@ -1195,7 +1197,7 @@ __acquires(uhci->lock) | |||
1195 | struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv; | 1197 | struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv; |
1196 | 1198 | ||
1197 | /* Isochronous TDs get unlinked directly from the frame list */ | 1199 | /* Isochronous TDs get unlinked directly from the frame list */ |
1198 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) | 1200 | if (qh->type == USB_ENDPOINT_XFER_ISOC) |
1199 | uhci_unlink_isochronous_tds(uhci, urb); | 1201 | uhci_unlink_isochronous_tds(uhci, urb); |
1200 | 1202 | ||
1201 | /* If the URB isn't first on its queue, adjust the link pointer | 1203 | /* If the URB isn't first on its queue, adjust the link pointer |
@@ -1224,13 +1226,13 @@ __acquires(uhci->lock) | |||
1224 | uhci_dec_fsbr(uhci, urb); /* Safe since it checks */ | 1226 | uhci_dec_fsbr(uhci, urb); /* Safe since it checks */ |
1225 | uhci_free_urb_priv(uhci, urbp); | 1227 | uhci_free_urb_priv(uhci, urbp); |
1226 | 1228 | ||
1227 | switch (usb_pipetype(urb->pipe)) { | 1229 | switch (qh->type) { |
1228 | case PIPE_ISOCHRONOUS: | 1230 | case USB_ENDPOINT_XFER_ISOC: |
1229 | /* Release bandwidth for Interrupt or Isoc. transfers */ | 1231 | /* Release bandwidth for Interrupt or Isoc. transfers */ |
1230 | if (urb->bandwidth) | 1232 | if (urb->bandwidth) |
1231 | usb_release_bandwidth(urb->dev, urb, 1); | 1233 | usb_release_bandwidth(urb->dev, urb, 1); |
1232 | break; | 1234 | break; |
1233 | case PIPE_INTERRUPT: | 1235 | case USB_ENDPOINT_XFER_INT: |
1234 | /* Release bandwidth for Interrupt or Isoc. transfers */ | 1236 | /* Release bandwidth for Interrupt or Isoc. transfers */ |
1235 | /* Make sure we don't release if we have a queued URB */ | 1237 | /* Make sure we don't release if we have a queued URB */ |
1236 | if (list_empty(&qh->queue) && urb->bandwidth) | 1238 | if (list_empty(&qh->queue) && urb->bandwidth) |
@@ -1273,14 +1275,14 @@ static void uhci_scan_qh(struct uhci_hcd *uhci, struct uhci_qh *qh, | |||
1273 | urbp = list_entry(qh->queue.next, struct urb_priv, node); | 1275 | urbp = list_entry(qh->queue.next, struct urb_priv, node); |
1274 | urb = urbp->urb; | 1276 | urb = urbp->urb; |
1275 | 1277 | ||
1276 | switch (usb_pipetype(urb->pipe)) { | 1278 | switch (qh->type) { |
1277 | case PIPE_CONTROL: | 1279 | case USB_ENDPOINT_XFER_CONTROL: |
1278 | status = uhci_result_control(uhci, urb); | 1280 | status = uhci_result_control(uhci, urb); |
1279 | break; | 1281 | break; |
1280 | case PIPE_ISOCHRONOUS: | 1282 | case USB_ENDPOINT_XFER_ISOC: |
1281 | status = uhci_result_isochronous(uhci, urb); | 1283 | status = uhci_result_isochronous(uhci, urb); |
1282 | break; | 1284 | break; |
1283 | default: /* PIPE_BULK or PIPE_INTERRUPT */ | 1285 | default: /* USB_ENDPOINT_XFER_BULK or _INT */ |
1284 | status = uhci_result_common(uhci, urb); | 1286 | status = uhci_result_common(uhci, urb); |
1285 | break; | 1287 | break; |
1286 | } | 1288 | } |