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 | |
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')
-rw-r--r-- | drivers/usb/host/uhci-debug.c | 26 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hcd.h | 1 | ||||
-rw-r--r-- | drivers/usb/host/uhci-q.c | 34 |
3 files changed, 38 insertions, 23 deletions
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index e1239319655c..28c1c51ec475 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -98,6 +98,7 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | |||
98 | char *out = buf; | 98 | char *out = buf; |
99 | struct uhci_td *td; | 99 | struct uhci_td *td; |
100 | int i, nactive, ninactive; | 100 | int i, nactive, ninactive; |
101 | char *ptype; | ||
101 | 102 | ||
102 | if (len < 200) | 103 | if (len < 200) |
103 | return 0; | 104 | return 0; |
@@ -110,13 +111,14 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | |||
110 | (usb_pipein(urbp->urb->pipe) ? "IN" : "OUT")); | 111 | (usb_pipein(urbp->urb->pipe) ? "IN" : "OUT")); |
111 | 112 | ||
112 | switch (usb_pipetype(urbp->urb->pipe)) { | 113 | switch (usb_pipetype(urbp->urb->pipe)) { |
113 | case PIPE_ISOCHRONOUS: out += sprintf(out, "ISO"); break; | 114 | case PIPE_ISOCHRONOUS: ptype = "ISO"; break; |
114 | case PIPE_INTERRUPT: out += sprintf(out, "INT"); break; | 115 | case PIPE_INTERRUPT: ptype = "INT"; break; |
115 | case PIPE_BULK: out += sprintf(out, "BLK"); break; | 116 | case PIPE_BULK: ptype = "BLK"; break; |
116 | case PIPE_CONTROL: out += sprintf(out, "CTL"); break; | 117 | default: |
118 | case PIPE_CONTROL: ptype = "CTL"; break; | ||
117 | } | 119 | } |
118 | 120 | ||
119 | out += sprintf(out, "%s", (urbp->fsbr ? " FSBR" : "")); | 121 | out += sprintf(out, "%s%s", ptype, (urbp->fsbr ? " FSBR" : "")); |
120 | 122 | ||
121 | if (urbp->urb->status != -EINPROGRESS) | 123 | if (urbp->urb->status != -EINPROGRESS) |
122 | out += sprintf(out, " Status=%d", urbp->urb->status); | 124 | out += sprintf(out, " Status=%d", urbp->urb->status); |
@@ -147,13 +149,23 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) | |||
147 | char *out = buf; | 149 | char *out = buf; |
148 | int i, nurbs; | 150 | int i, nurbs; |
149 | __le32 element = qh_element(qh); | 151 | __le32 element = qh_element(qh); |
152 | char *qtype; | ||
150 | 153 | ||
151 | /* Try to make sure there's enough memory */ | 154 | /* Try to make sure there's enough memory */ |
152 | if (len < 80 * 6) | 155 | if (len < 80 * 6) |
153 | return 0; | 156 | return 0; |
154 | 157 | ||
155 | out += sprintf(out, "%*s[%p] link (%08x) element (%08x)\n", space, "", | 158 | switch (qh->type) { |
156 | qh, le32_to_cpu(qh->link), le32_to_cpu(element)); | 159 | case USB_ENDPOINT_XFER_ISOC: qtype = "ISO"; break; |
160 | case USB_ENDPOINT_XFER_INT: qtype = "INT"; break; | ||
161 | case USB_ENDPOINT_XFER_BULK: qtype = "BLK"; break; | ||
162 | case USB_ENDPOINT_XFER_CONTROL: qtype = "CTL"; break; | ||
163 | default: qtype = "Skel" ; break; | ||
164 | } | ||
165 | |||
166 | out += sprintf(out, "%*s[%p] %s QH link (%08x) element (%08x)\n", | ||
167 | space, "", qh, qtype, | ||
168 | le32_to_cpu(qh->link), le32_to_cpu(element)); | ||
157 | 169 | ||
158 | if (element & UHCI_PTR_QH) | 170 | if (element & UHCI_PTR_QH) |
159 | out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); | 171 | out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); |
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h index d5c8f4d92823..8e5778650493 100644 --- a/drivers/usb/host/uhci-hcd.h +++ b/drivers/usb/host/uhci-hcd.h | |||
@@ -132,6 +132,7 @@ struct uhci_qh { | |||
132 | 132 | ||
133 | unsigned int unlink_frame; /* When the QH was unlinked */ | 133 | unsigned int unlink_frame; /* When the QH was unlinked */ |
134 | int state; /* QH_STATE_xxx; see above */ | 134 | int state; /* QH_STATE_xxx; see above */ |
135 | int type; /* Queue type (control, bulk, etc) */ | ||
135 | 136 | ||
136 | unsigned int initial_toggle:1; /* Endpoint's current toggle value */ | 137 | unsigned int initial_toggle:1; /* Endpoint's current toggle value */ |
137 | unsigned int needs_fixup:1; /* Must fix the TD toggle values */ | 138 | unsigned int needs_fixup:1; /* Must fix the TD toggle values */ |
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 | } |