diff options
Diffstat (limited to 'drivers/usb/host/fhci-tds.c')
-rw-r--r-- | drivers/usb/host/fhci-tds.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c index b40332290319..57013479d7f7 100644 --- a/drivers/usb/host/fhci-tds.c +++ b/drivers/usb/host/fhci-tds.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/list.h> | 22 | #include <linux/list.h> |
22 | #include <linux/io.h> | 23 | #include <linux/io.h> |
23 | #include <linux/usb.h> | 24 | #include <linux/usb.h> |
@@ -105,34 +106,34 @@ void fhci_ep0_free(struct fhci_usb *usb) | |||
105 | if (ep->td_base) | 106 | if (ep->td_base) |
106 | cpm_muram_free(cpm_muram_offset(ep->td_base)); | 107 | cpm_muram_free(cpm_muram_offset(ep->td_base)); |
107 | 108 | ||
108 | if (ep->conf_frame_Q) { | 109 | if (kfifo_initialized(&ep->conf_frame_Q)) { |
109 | size = cq_howmany(ep->conf_frame_Q); | 110 | size = cq_howmany(&ep->conf_frame_Q); |
110 | for (; size; size--) { | 111 | for (; size; size--) { |
111 | struct packet *pkt = cq_get(ep->conf_frame_Q); | 112 | struct packet *pkt = cq_get(&ep->conf_frame_Q); |
112 | 113 | ||
113 | kfree(pkt); | 114 | kfree(pkt); |
114 | } | 115 | } |
115 | cq_delete(ep->conf_frame_Q); | 116 | cq_delete(&ep->conf_frame_Q); |
116 | } | 117 | } |
117 | 118 | ||
118 | if (ep->empty_frame_Q) { | 119 | if (kfifo_initialized(&ep->empty_frame_Q)) { |
119 | size = cq_howmany(ep->empty_frame_Q); | 120 | size = cq_howmany(&ep->empty_frame_Q); |
120 | for (; size; size--) { | 121 | for (; size; size--) { |
121 | struct packet *pkt = cq_get(ep->empty_frame_Q); | 122 | struct packet *pkt = cq_get(&ep->empty_frame_Q); |
122 | 123 | ||
123 | kfree(pkt); | 124 | kfree(pkt); |
124 | } | 125 | } |
125 | cq_delete(ep->empty_frame_Q); | 126 | cq_delete(&ep->empty_frame_Q); |
126 | } | 127 | } |
127 | 128 | ||
128 | if (ep->dummy_packets_Q) { | 129 | if (kfifo_initialized(&ep->dummy_packets_Q)) { |
129 | size = cq_howmany(ep->dummy_packets_Q); | 130 | size = cq_howmany(&ep->dummy_packets_Q); |
130 | for (; size; size--) { | 131 | for (; size; size--) { |
131 | u8 *buff = cq_get(ep->dummy_packets_Q); | 132 | u8 *buff = cq_get(&ep->dummy_packets_Q); |
132 | 133 | ||
133 | kfree(buff); | 134 | kfree(buff); |
134 | } | 135 | } |
135 | cq_delete(ep->dummy_packets_Q); | 136 | cq_delete(&ep->dummy_packets_Q); |
136 | } | 137 | } |
137 | 138 | ||
138 | kfree(ep); | 139 | kfree(ep); |
@@ -175,10 +176,9 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
175 | ep->td_base = cpm_muram_addr(ep_offset); | 176 | ep->td_base = cpm_muram_addr(ep_offset); |
176 | 177 | ||
177 | /* zero all queue pointers */ | 178 | /* zero all queue pointers */ |
178 | ep->conf_frame_Q = cq_new(ring_len + 2); | 179 | if (cq_new(&ep->conf_frame_Q, ring_len + 2) || |
179 | ep->empty_frame_Q = cq_new(ring_len + 2); | 180 | cq_new(&ep->empty_frame_Q, ring_len + 2) || |
180 | ep->dummy_packets_Q = cq_new(ring_len + 2); | 181 | cq_new(&ep->dummy_packets_Q, ring_len + 2)) { |
181 | if (!ep->conf_frame_Q || !ep->empty_frame_Q || !ep->dummy_packets_Q) { | ||
182 | err_for = "frame_queues"; | 182 | err_for = "frame_queues"; |
183 | goto err; | 183 | goto err; |
184 | } | 184 | } |
@@ -199,8 +199,8 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
199 | err_for = "buffer"; | 199 | err_for = "buffer"; |
200 | goto err; | 200 | goto err; |
201 | } | 201 | } |
202 | cq_put(ep->empty_frame_Q, pkt); | 202 | cq_put(&ep->empty_frame_Q, pkt); |
203 | cq_put(ep->dummy_packets_Q, buff); | 203 | cq_put(&ep->dummy_packets_Q, buff); |
204 | } | 204 | } |
205 | 205 | ||
206 | /* we put the endpoint parameter RAM right behind the TD ring */ | 206 | /* we put the endpoint parameter RAM right behind the TD ring */ |
@@ -319,7 +319,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb) | |||
319 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) | 319 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) |
320 | continue; | 320 | continue; |
321 | 321 | ||
322 | pkt = cq_get(ep->conf_frame_Q); | 322 | pkt = cq_get(&ep->conf_frame_Q); |
323 | if (!pkt) | 323 | if (!pkt) |
324 | fhci_err(usb->fhci, "no frame to confirm\n"); | 324 | fhci_err(usb->fhci, "no frame to confirm\n"); |
325 | 325 | ||
@@ -460,9 +460,9 @@ u32 fhci_host_transaction(struct fhci_usb *usb, | |||
460 | out_be16(&td->length, pkt->len); | 460 | out_be16(&td->length, pkt->len); |
461 | 461 | ||
462 | /* put the frame to the confirmation queue */ | 462 | /* put the frame to the confirmation queue */ |
463 | cq_put(ep->conf_frame_Q, pkt); | 463 | cq_put(&ep->conf_frame_Q, pkt); |
464 | 464 | ||
465 | if (cq_howmany(ep->conf_frame_Q) == 1) | 465 | if (cq_howmany(&ep->conf_frame_Q) == 1) |
466 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); | 466 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); |
467 | 467 | ||
468 | return 0; | 468 | return 0; |