diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/fhci-sched.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/fhci-tds.c | 35 | ||||
-rw-r--r-- | drivers/usb/host/fhci.h | 10 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 5 |
4 files changed, 29 insertions, 31 deletions
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index 00a29855d0c4..ff43747a614f 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c | |||
@@ -37,7 +37,7 @@ static void recycle_frame(struct fhci_usb *usb, struct packet *pkt) | |||
37 | pkt->info = 0; | 37 | pkt->info = 0; |
38 | pkt->priv_data = NULL; | 38 | pkt->priv_data = NULL; |
39 | 39 | ||
40 | cq_put(usb->ep0->empty_frame_Q, pkt); | 40 | cq_put(&usb->ep0->empty_frame_Q, pkt); |
41 | } | 41 | } |
42 | 42 | ||
43 | /* confirm submitted packet */ | 43 | /* confirm submitted packet */ |
@@ -57,7 +57,7 @@ void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt) | |||
57 | if ((td->data + td->actual_len) && trans_len) | 57 | if ((td->data + td->actual_len) && trans_len) |
58 | memcpy(td->data + td->actual_len, pkt->data, | 58 | memcpy(td->data + td->actual_len, pkt->data, |
59 | trans_len); | 59 | trans_len); |
60 | cq_put(usb->ep0->dummy_packets_Q, pkt->data); | 60 | cq_put(&usb->ep0->dummy_packets_Q, pkt->data); |
61 | } | 61 | } |
62 | 62 | ||
63 | recycle_frame(usb, pkt); | 63 | recycle_frame(usb, pkt); |
@@ -213,7 +213,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | /* update frame object fields before transmitting */ | 215 | /* update frame object fields before transmitting */ |
216 | pkt = cq_get(usb->ep0->empty_frame_Q); | 216 | pkt = cq_get(&usb->ep0->empty_frame_Q); |
217 | if (!pkt) { | 217 | if (!pkt) { |
218 | fhci_dbg(usb->fhci, "there is no empty frame\n"); | 218 | fhci_dbg(usb->fhci, "there is no empty frame\n"); |
219 | return -1; | 219 | return -1; |
@@ -222,7 +222,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
222 | 222 | ||
223 | pkt->info = 0; | 223 | pkt->info = 0; |
224 | if (data == NULL) { | 224 | if (data == NULL) { |
225 | data = cq_get(usb->ep0->dummy_packets_Q); | 225 | data = cq_get(&usb->ep0->dummy_packets_Q); |
226 | BUG_ON(!data); | 226 | BUG_ON(!data); |
227 | pkt->info = PKT_DUMMY_PACKET; | 227 | pkt->info = PKT_DUMMY_PACKET; |
228 | } | 228 | } |
@@ -246,7 +246,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
246 | list_del_init(&td->frame_lh); | 246 | list_del_init(&td->frame_lh); |
247 | td->status = USB_TD_OK; | 247 | td->status = USB_TD_OK; |
248 | if (pkt->info & PKT_DUMMY_PACKET) | 248 | if (pkt->info & PKT_DUMMY_PACKET) |
249 | cq_put(usb->ep0->dummy_packets_Q, pkt->data); | 249 | cq_put(&usb->ep0->dummy_packets_Q, pkt->data); |
250 | recycle_frame(usb, pkt); | 250 | recycle_frame(usb, pkt); |
251 | usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD); | 251 | usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD); |
252 | fhci_err(usb->fhci, "host transaction failed\n"); | 252 | fhci_err(usb->fhci, "host transaction failed\n"); |
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c index b40332290319..d224ab467a40 100644 --- a/drivers/usb/host/fhci-tds.c +++ b/drivers/usb/host/fhci-tds.c | |||
@@ -106,33 +106,33 @@ void fhci_ep0_free(struct fhci_usb *usb) | |||
106 | cpm_muram_free(cpm_muram_offset(ep->td_base)); | 106 | cpm_muram_free(cpm_muram_offset(ep->td_base)); |
107 | 107 | ||
108 | if (ep->conf_frame_Q) { | 108 | if (ep->conf_frame_Q) { |
109 | size = cq_howmany(ep->conf_frame_Q); | 109 | size = cq_howmany(&ep->conf_frame_Q); |
110 | for (; size; size--) { | 110 | for (; size; size--) { |
111 | struct packet *pkt = cq_get(ep->conf_frame_Q); | 111 | struct packet *pkt = cq_get(&ep->conf_frame_Q); |
112 | 112 | ||
113 | kfree(pkt); | 113 | kfree(pkt); |
114 | } | 114 | } |
115 | cq_delete(ep->conf_frame_Q); | 115 | cq_delete(&ep->conf_frame_Q); |
116 | } | 116 | } |
117 | 117 | ||
118 | if (ep->empty_frame_Q) { | 118 | if (ep->empty_frame_Q) { |
119 | size = cq_howmany(ep->empty_frame_Q); | 119 | size = cq_howmany(&ep->empty_frame_Q); |
120 | for (; size; size--) { | 120 | for (; size; size--) { |
121 | struct packet *pkt = cq_get(ep->empty_frame_Q); | 121 | struct packet *pkt = cq_get(&ep->empty_frame_Q); |
122 | 122 | ||
123 | kfree(pkt); | 123 | kfree(pkt); |
124 | } | 124 | } |
125 | cq_delete(ep->empty_frame_Q); | 125 | cq_delete(&ep->empty_frame_Q); |
126 | } | 126 | } |
127 | 127 | ||
128 | if (ep->dummy_packets_Q) { | 128 | if (ep->dummy_packets_Q) { |
129 | size = cq_howmany(ep->dummy_packets_Q); | 129 | size = cq_howmany(&ep->dummy_packets_Q); |
130 | for (; size; size--) { | 130 | for (; size; size--) { |
131 | u8 *buff = cq_get(ep->dummy_packets_Q); | 131 | u8 *buff = cq_get(&ep->dummy_packets_Q); |
132 | 132 | ||
133 | kfree(buff); | 133 | kfree(buff); |
134 | } | 134 | } |
135 | cq_delete(ep->dummy_packets_Q); | 135 | cq_delete(&ep->dummy_packets_Q); |
136 | } | 136 | } |
137 | 137 | ||
138 | kfree(ep); | 138 | kfree(ep); |
@@ -175,10 +175,9 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
175 | ep->td_base = cpm_muram_addr(ep_offset); | 175 | ep->td_base = cpm_muram_addr(ep_offset); |
176 | 176 | ||
177 | /* zero all queue pointers */ | 177 | /* zero all queue pointers */ |
178 | ep->conf_frame_Q = cq_new(ring_len + 2); | 178 | if (cq_new(&ep->conf_frame_Q, ring_len + 2) || |
179 | ep->empty_frame_Q = cq_new(ring_len + 2); | 179 | cq_new(&ep->empty_frame_Q, ring_len + 2) || |
180 | ep->dummy_packets_Q = cq_new(ring_len + 2); | 180 | 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"; | 181 | err_for = "frame_queues"; |
183 | goto err; | 182 | goto err; |
184 | } | 183 | } |
@@ -199,8 +198,8 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
199 | err_for = "buffer"; | 198 | err_for = "buffer"; |
200 | goto err; | 199 | goto err; |
201 | } | 200 | } |
202 | cq_put(ep->empty_frame_Q, pkt); | 201 | cq_put(&ep->empty_frame_Q, pkt); |
203 | cq_put(ep->dummy_packets_Q, buff); | 202 | cq_put(&ep->dummy_packets_Q, buff); |
204 | } | 203 | } |
205 | 204 | ||
206 | /* we put the endpoint parameter RAM right behind the TD ring */ | 205 | /* we put the endpoint parameter RAM right behind the TD ring */ |
@@ -319,7 +318,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb) | |||
319 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) | 318 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) |
320 | continue; | 319 | continue; |
321 | 320 | ||
322 | pkt = cq_get(ep->conf_frame_Q); | 321 | pkt = cq_get(&ep->conf_frame_Q); |
323 | if (!pkt) | 322 | if (!pkt) |
324 | fhci_err(usb->fhci, "no frame to confirm\n"); | 323 | fhci_err(usb->fhci, "no frame to confirm\n"); |
325 | 324 | ||
@@ -460,9 +459,9 @@ u32 fhci_host_transaction(struct fhci_usb *usb, | |||
460 | out_be16(&td->length, pkt->len); | 459 | out_be16(&td->length, pkt->len); |
461 | 460 | ||
462 | /* put the frame to the confirmation queue */ | 461 | /* put the frame to the confirmation queue */ |
463 | cq_put(ep->conf_frame_Q, pkt); | 462 | cq_put(&ep->conf_frame_Q, pkt); |
464 | 463 | ||
465 | if (cq_howmany(ep->conf_frame_Q) == 1) | 464 | if (cq_howmany(&ep->conf_frame_Q) == 1) |
466 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); | 465 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); |
467 | 466 | ||
468 | return 0; | 467 | return 0; |
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h index 7116284ed21a..2277428ef5d3 100644 --- a/drivers/usb/host/fhci.h +++ b/drivers/usb/host/fhci.h | |||
@@ -423,9 +423,9 @@ struct endpoint { | |||
423 | struct usb_td __iomem *td_base; /* first TD in the ring */ | 423 | struct usb_td __iomem *td_base; /* first TD in the ring */ |
424 | struct usb_td __iomem *conf_td; /* next TD for confirm after transac */ | 424 | struct usb_td __iomem *conf_td; /* next TD for confirm after transac */ |
425 | struct usb_td __iomem *empty_td;/* next TD for new transaction req. */ | 425 | struct usb_td __iomem *empty_td;/* next TD for new transaction req. */ |
426 | struct kfifo *empty_frame_Q; /* Empty frames list to use */ | 426 | struct kfifo empty_frame_Q; /* Empty frames list to use */ |
427 | struct kfifo *conf_frame_Q; /* frames passed to TDs,waiting for tx */ | 427 | struct kfifo conf_frame_Q; /* frames passed to TDs,waiting for tx */ |
428 | struct kfifo *dummy_packets_Q;/* dummy packets for the CRC overun */ | 428 | struct kfifo dummy_packets_Q;/* dummy packets for the CRC overun */ |
429 | 429 | ||
430 | bool already_pushed_dummy_bd; | 430 | bool already_pushed_dummy_bd; |
431 | }; | 431 | }; |
@@ -493,9 +493,9 @@ static inline struct usb_hcd *fhci_to_hcd(struct fhci_hcd *fhci) | |||
493 | } | 493 | } |
494 | 494 | ||
495 | /* fifo of pointers */ | 495 | /* fifo of pointers */ |
496 | static inline struct kfifo *cq_new(int size) | 496 | static inline int cq_new(struct kfifo *fifo, int size) |
497 | { | 497 | { |
498 | return kfifo_alloc(size * sizeof(void *), GFP_KERNEL, NULL); | 498 | return kfifo_alloc(fifo, size * sizeof(void *), GFP_KERNEL, NULL); |
499 | } | 499 | } |
500 | 500 | ||
501 | static inline void cq_delete(struct kfifo *kfifo) | 501 | static inline void cq_delete(struct kfifo *kfifo) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 4543f359be75..44b72d47fac2 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -939,9 +939,8 @@ int usb_serial_probe(struct usb_interface *interface, | |||
939 | dev_err(&interface->dev, "No free urbs available\n"); | 939 | dev_err(&interface->dev, "No free urbs available\n"); |
940 | goto probe_error; | 940 | goto probe_error; |
941 | } | 941 | } |
942 | port->write_fifo = kfifo_alloc(PAGE_SIZE, GFP_KERNEL, | 942 | if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL, |
943 | &port->lock); | 943 | &port->lock)) |
944 | if (IS_ERR(port->write_fifo)) | ||
945 | goto probe_error; | 944 | goto probe_error; |
946 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); | 945 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); |
947 | port->bulk_out_size = buffer_size; | 946 | port->bulk_out_size = buffer_size; |