2 * Wireless Host Controller (WHC) qset management.
4 * Copyright (C) 2007 Cambridge Silicon Radio Ltd.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/kernel.h>
19 #include <linux/dma-mapping.h>
20 #include <linux/slab.h>
21 #include <linux/uwb/umc.h>
22 #include <linux/usb.h>
24 #include "../../wusbcore/wusbhc.h"
28 struct whc_qset
*qset_alloc(struct whc
*whc
, gfp_t mem_flags
)
30 struct whc_qset
*qset
;
33 qset
= dma_pool_zalloc(whc
->qset_pool
, mem_flags
, &dma
);
40 INIT_LIST_HEAD(&qset
->list_node
);
41 INIT_LIST_HEAD(&qset
->stds
);
47 * qset_fill_qh - fill the static endpoint state in a qset's QHead
48 * @qset: the qset whose QH needs initializing with static endpoint
50 * @urb: an urb for a transfer to this endpoint
52 static void qset_fill_qh(struct whc
*whc
, struct whc_qset
*qset
, struct urb
*urb
)
54 struct usb_device
*usb_dev
= urb
->dev
;
55 struct wusb_dev
*wusb_dev
= usb_dev
->wusb_dev
;
56 struct usb_wireless_ep_comp_descriptor
*epcd
;
60 is_out
= usb_pipeout(urb
->pipe
);
62 qset
->max_packet
= le16_to_cpu(urb
->ep
->desc
.wMaxPacketSize
);
64 epcd
= (struct usb_wireless_ep_comp_descriptor
*)qset
->ep
->extra
;
66 qset
->max_seq
= epcd
->bMaxSequence
;
67 qset
->max_burst
= epcd
->bMaxBurst
;
74 * Initial PHY rate is 53.3 Mbit/s for control endpoints or
75 * the maximum supported by the device for other endpoints
76 * (unless limited by the user).
78 if (usb_pipecontrol(urb
->pipe
))
79 phy_rate
= UWB_PHY_RATE_53
;
83 phy_rates
= le16_to_cpu(wusb_dev
->wusb_cap_descr
->wPHYRates
);
84 phy_rate
= fls(phy_rates
) - 1;
85 if (phy_rate
> whc
->wusbhc
.phy_rate
)
86 phy_rate
= whc
->wusbhc
.phy_rate
;
89 qset
->qh
.info1
= cpu_to_le32(
90 QH_INFO1_EP(usb_pipeendpoint(urb
->pipe
))
91 | (is_out
? QH_INFO1_DIR_OUT
: QH_INFO1_DIR_IN
)
92 | usb_pipe_to_qh_type(urb
->pipe
)
93 | QH_INFO1_DEV_INFO_IDX(wusb_port_no_to_idx(usb_dev
->portnum
))
94 | QH_INFO1_MAX_PKT_LEN(qset
->max_packet
)
96 qset
->qh
.info2
= cpu_to_le32(
97 QH_INFO2_BURST(qset
->max_burst
)
99 | QH_INFO2_MAX_COUNT(3)
100 | QH_INFO2_MAX_RETRY(3)
101 | QH_INFO2_MAX_SEQ(qset
->max_seq
- 1)
103 /* FIXME: where can we obtain these Tx parameters from? Why
104 * doesn't the chip know what Tx power to use? It knows the Rx
105 * strength and can presumably guess the Tx power required
107 qset
->qh
.info3
= cpu_to_le32(
108 QH_INFO3_TX_RATE(phy_rate
)
109 | QH_INFO3_TX_PWR(0) /* 0 == max power */
112 qset
->qh
.cur_window
= cpu_to_le32((1 << qset
->max_burst
) - 1);
116 * qset_clear - clear fields in a qset so it may be reinserted into a
119 * The sequence number and current window are not cleared (see
122 void qset_clear(struct whc
*whc
, struct whc_qset
*qset
)
124 qset
->td_start
= qset
->td_end
= qset
->ntds
= 0;
126 qset
->qh
.link
= cpu_to_le64(QH_LINK_NTDS(8) | QH_LINK_T
);
127 qset
->qh
.status
= qset
->qh
.status
& QH_STATUS_SEQ_MASK
;
128 qset
->qh
.err_count
= 0;
129 qset
->qh
.scratch
[0] = 0;
130 qset
->qh
.scratch
[1] = 0;
131 qset
->qh
.scratch
[2] = 0;
133 memset(&qset
->qh
.overlay
, 0, sizeof(qset
->qh
.overlay
));
135 init_completion(&qset
->remove_complete
);
139 * qset_reset - reset endpoint state in a qset.
141 * Clears the sequence number and current window. This qset must not
142 * be in the ASL or PZL.
144 void qset_reset(struct whc
*whc
, struct whc_qset
*qset
)
148 qset
->qh
.status
&= ~QH_STATUS_SEQ_MASK
;
149 qset
->qh
.cur_window
= cpu_to_le32((1 << qset
->max_burst
) - 1);
153 * get_qset - get the qset for an async endpoint
155 * A new qset is created if one does not already exist.
157 struct whc_qset
*get_qset(struct whc
*whc
, struct urb
*urb
,
160 struct whc_qset
*qset
;
162 qset
= urb
->ep
->hcpriv
;
164 qset
= qset_alloc(whc
, mem_flags
);
169 urb
->ep
->hcpriv
= qset
;
170 qset_fill_qh(whc
, qset
, urb
);
175 void qset_remove_complete(struct whc
*whc
, struct whc_qset
*qset
)
178 list_del_init(&qset
->list_node
);
179 complete(&qset
->remove_complete
);
183 * qset_add_qtds - add qTDs for an URB to a qset
185 * Returns true if the list (ASL/PZL) must be updated because (for a
186 * WHCI 0.95 controller) an activated qTD was pointed to be iCur.
188 enum whc_update
qset_add_qtds(struct whc
*whc
, struct whc_qset
*qset
)
191 enum whc_update update
= 0;
193 list_for_each_entry(std
, &qset
->stds
, list_node
) {
197 if (qset
->ntds
>= WHCI_QSET_TD_MAX
198 || (qset
->pause_after_urb
&& std
->urb
!= qset
->pause_after_urb
))
202 continue; /* already has a qTD */
204 qtd
= std
->qtd
= &qset
->qtd
[qset
->td_end
];
206 /* Fill in setup bytes for control transfers. */
207 if (usb_pipecontrol(std
->urb
->pipe
))
208 memcpy(qtd
->setup
, std
->urb
->setup_packet
, 8);
210 status
= QTD_STS_ACTIVE
| QTD_STS_LEN(std
->len
);
212 if (whc_std_last(std
) && usb_pipeout(std
->urb
->pipe
))
213 status
|= QTD_STS_LAST_PKT
;
216 * For an IN transfer the iAlt field should be set so
217 * the h/w will automatically advance to the next
218 * transfer. However, if there are 8 or more TDs
219 * remaining in this transfer then iAlt cannot be set
220 * as it could point to somewhere in this transfer.
222 if (std
->ntds_remaining
< WHCI_QSET_TD_MAX
) {
224 ialt
= (qset
->td_end
+ std
->ntds_remaining
) % WHCI_QSET_TD_MAX
;
225 status
|= QTD_STS_IALT(ialt
);
226 } else if (usb_pipein(std
->urb
->pipe
))
227 qset
->pause_after_urb
= std
->urb
;
229 if (std
->num_pointers
)
230 qtd
->options
= cpu_to_le32(QTD_OPT_IOC
);
232 qtd
->options
= cpu_to_le32(QTD_OPT_IOC
| QTD_OPT_SMALL
);
233 qtd
->page_list_ptr
= cpu_to_le64(std
->dma_addr
);
235 qtd
->status
= cpu_to_le32(status
);
237 if (QH_STATUS_TO_ICUR(qset
->qh
.status
) == qset
->td_end
)
238 update
= WHC_UPDATE_UPDATED
;
240 if (++qset
->td_end
>= WHCI_QSET_TD_MAX
)
249 * qset_remove_qtd - remove the first qTD from a qset.
251 * The qTD might be still active (if it's part of a IN URB that
252 * resulted in a short read) so ensure it's deactivated.
254 static void qset_remove_qtd(struct whc
*whc
, struct whc_qset
*qset
)
256 qset
->qtd
[qset
->td_start
].status
= 0;
258 if (++qset
->td_start
>= WHCI_QSET_TD_MAX
)
263 static void qset_copy_bounce_to_sg(struct whc
*whc
, struct whc_std
*std
)
265 struct scatterlist
*sg
;
267 size_t remaining
, offset
;
269 bounce
= std
->bounce_buf
;
270 remaining
= std
->len
;
273 offset
= std
->bounce_offset
;
278 len
= min(sg
->length
- offset
, remaining
);
279 memcpy(sg_virt(sg
) + offset
, bounce
, len
);
285 if (offset
>= sg
->length
) {
294 * qset_free_std - remove an sTD and free it.
295 * @whc: the WHCI host controller
296 * @std: the sTD to remove and free.
298 void qset_free_std(struct whc
*whc
, struct whc_std
*std
)
300 list_del(&std
->list_node
);
301 if (std
->bounce_buf
) {
302 bool is_out
= usb_pipeout(std
->urb
->pipe
);
305 if (std
->num_pointers
)
306 dma_addr
= le64_to_cpu(std
->pl_virt
[0].buf_ptr
);
308 dma_addr
= std
->dma_addr
;
310 dma_unmap_single(whc
->wusbhc
.dev
, dma_addr
,
311 std
->len
, is_out
? DMA_TO_DEVICE
: DMA_FROM_DEVICE
);
313 qset_copy_bounce_to_sg(whc
, std
);
314 kfree(std
->bounce_buf
);
317 if (!dma_mapping_error(whc
->wusbhc
.dev
, std
->dma_addr
))
318 dma_unmap_single(whc
->wusbhc
.dev
, std
->dma_addr
,
319 std
->num_pointers
* sizeof(struct whc_page_list_entry
),
328 * qset_remove_qtds - remove an URB's qTDs (and sTDs).
330 static void qset_remove_qtds(struct whc
*whc
, struct whc_qset
*qset
,
333 struct whc_std
*std
, *t
;
335 list_for_each_entry_safe(std
, t
, &qset
->stds
, list_node
) {
338 if (std
->qtd
!= NULL
)
339 qset_remove_qtd(whc
, qset
);
340 qset_free_std(whc
, std
);
345 * qset_free_stds - free any remaining sTDs for an URB.
347 static void qset_free_stds(struct whc_qset
*qset
, struct urb
*urb
)
349 struct whc_std
*std
, *t
;
351 list_for_each_entry_safe(std
, t
, &qset
->stds
, list_node
) {
353 qset_free_std(qset
->whc
, std
);
357 static int qset_fill_page_list(struct whc
*whc
, struct whc_std
*std
, gfp_t mem_flags
)
359 dma_addr_t dma_addr
= std
->dma_addr
;
364 /* Short buffers don't need a page list. */
365 if (std
->len
<= WHCI_PAGE_SIZE
) {
366 std
->num_pointers
= 0;
370 sp
= dma_addr
& ~(WHCI_PAGE_SIZE
-1);
371 ep
= dma_addr
+ std
->len
;
372 std
->num_pointers
= DIV_ROUND_UP(ep
- sp
, WHCI_PAGE_SIZE
);
374 pl_len
= std
->num_pointers
* sizeof(struct whc_page_list_entry
);
375 std
->pl_virt
= kmalloc(pl_len
, mem_flags
);
376 if (std
->pl_virt
== NULL
)
378 std
->dma_addr
= dma_map_single(whc
->wusbhc
.dev
, std
->pl_virt
, pl_len
, DMA_TO_DEVICE
);
379 if (dma_mapping_error(whc
->wusbhc
.dev
, std
->dma_addr
)) {
384 for (p
= 0; p
< std
->num_pointers
; p
++) {
385 std
->pl_virt
[p
].buf_ptr
= cpu_to_le64(dma_addr
);
386 dma_addr
= (dma_addr
+ WHCI_PAGE_SIZE
) & ~(WHCI_PAGE_SIZE
-1);
393 * urb_dequeue_work - executes asl/pzl update and gives back the urb to the system.
395 static void urb_dequeue_work(struct work_struct
*work
)
397 struct whc_urb
*wurb
= container_of(work
, struct whc_urb
, dequeue_work
);
398 struct whc_qset
*qset
= wurb
->qset
;
399 struct whc
*whc
= qset
->whc
;
403 asl_update(whc
, WUSBCMD_ASYNC_UPDATED
404 | WUSBCMD_ASYNC_SYNCED_DB
405 | WUSBCMD_ASYNC_QSET_RM
);
407 pzl_update(whc
, WUSBCMD_PERIODIC_UPDATED
408 | WUSBCMD_PERIODIC_SYNCED_DB
409 | WUSBCMD_PERIODIC_QSET_RM
);
411 spin_lock_irqsave(&whc
->lock
, flags
);
412 qset_remove_urb(whc
, qset
, wurb
->urb
, wurb
->status
);
413 spin_unlock_irqrestore(&whc
->lock
, flags
);
416 static struct whc_std
*qset_new_std(struct whc
*whc
, struct whc_qset
*qset
,
417 struct urb
*urb
, gfp_t mem_flags
)
421 std
= kzalloc(sizeof(struct whc_std
), mem_flags
);
428 INIT_LIST_HEAD(&std
->list_node
);
429 list_add_tail(&std
->list_node
, &qset
->stds
);
434 static int qset_add_urb_sg(struct whc
*whc
, struct whc_qset
*qset
, struct urb
*urb
,
438 struct scatterlist
*sg
;
441 struct whc_std
*std
= NULL
;
442 struct whc_page_list_entry
*new_pl_virt
;
443 dma_addr_t prev_end
= 0;
447 remaining
= urb
->transfer_buffer_length
;
449 for_each_sg(urb
->sg
, sg
, urb
->num_mapped_sgs
, i
) {
451 size_t dma_remaining
;
455 if (remaining
== 0) {
459 dma_addr
= sg_dma_address(sg
);
460 dma_remaining
= min_t(size_t, sg_dma_len(sg
), remaining
);
462 while (dma_remaining
) {
466 * We can use the previous std (if it exists) provided that:
467 * - the previous one ended on a page boundary.
468 * - the current one begins on a page boundary.
469 * - the previous one isn't full.
471 * If a new std is needed but the previous one
472 * was not a whole number of packets then this
473 * sg list cannot be mapped onto multiple
474 * qTDs. Return an error and let the caller
478 || (prev_end
& (WHCI_PAGE_SIZE
-1))
479 || (dma_addr
& (WHCI_PAGE_SIZE
-1))
480 || std
->len
+ WHCI_PAGE_SIZE
> QTD_MAX_XFER_SIZE
) {
481 if (std
&& std
->len
% qset
->max_packet
!= 0)
483 std
= qset_new_std(whc
, qset
, urb
, mem_flags
);
491 dma_len
= dma_remaining
;
494 * If the remainder of this element doesn't
495 * fit in a single qTD, limit the qTD to a
496 * whole number of packets. This allows the
497 * remainder to go into the next qTD.
499 if (std
->len
+ dma_len
> QTD_MAX_XFER_SIZE
) {
500 dma_len
= (QTD_MAX_XFER_SIZE
/ qset
->max_packet
)
501 * qset
->max_packet
- std
->len
;
505 std
->ntds_remaining
= -1; /* filled in later */
507 sp
= dma_addr
& ~(WHCI_PAGE_SIZE
-1);
508 ep
= dma_addr
+ dma_len
;
509 num_pointers
= DIV_ROUND_UP(ep
- sp
, WHCI_PAGE_SIZE
);
510 std
->num_pointers
+= num_pointers
;
512 pl_len
= std
->num_pointers
* sizeof(struct whc_page_list_entry
);
514 new_pl_virt
= krealloc(std
->pl_virt
, pl_len
, mem_flags
);
515 if (new_pl_virt
== NULL
) {
520 std
->pl_virt
= new_pl_virt
;
522 for (;p
< std
->num_pointers
; p
++) {
523 std
->pl_virt
[p
].buf_ptr
= cpu_to_le64(dma_addr
);
524 dma_addr
= (dma_addr
+ WHCI_PAGE_SIZE
) & ~(WHCI_PAGE_SIZE
-1);
527 prev_end
= dma_addr
= ep
;
528 dma_remaining
-= dma_len
;
529 remaining
-= dma_len
;
533 /* Now the number of stds is know, go back and fill in
534 std->ntds_remaining. */
535 list_for_each_entry(std
, &qset
->stds
, list_node
) {
536 if (std
->ntds_remaining
== -1) {
537 pl_len
= std
->num_pointers
* sizeof(struct whc_page_list_entry
);
538 std
->dma_addr
= dma_map_single(whc
->wusbhc
.dev
, std
->pl_virt
,
539 pl_len
, DMA_TO_DEVICE
);
540 if (dma_mapping_error(whc
->wusbhc
.dev
, std
->dma_addr
))
542 std
->ntds_remaining
= ntds
--;
549 * qset_add_urb_sg_linearize - add an urb with sg list, copying the data
551 * If the URB contains an sg list whose elements cannot be directly
552 * mapped to qTDs then the data must be transferred via bounce
555 static int qset_add_urb_sg_linearize(struct whc
*whc
, struct whc_qset
*qset
,
556 struct urb
*urb
, gfp_t mem_flags
)
558 bool is_out
= usb_pipeout(urb
->pipe
);
562 struct whc_std
*std
= NULL
;
564 struct scatterlist
*sg
;
567 /* limit maximum bounce buffer to 16 * 3.5 KiB ~= 28 k */
568 max_std_len
= qset
->max_burst
* qset
->max_packet
;
570 remaining
= urb
->transfer_buffer_length
;
572 for_each_sg(urb
->sg
, sg
, urb
->num_mapped_sgs
, i
) {
577 if (remaining
== 0) {
581 sg_remaining
= min_t(size_t, remaining
, sg
->length
);
584 while (sg_remaining
) {
585 if (!std
|| std
->len
== max_std_len
) {
586 std
= qset_new_std(whc
, qset
, urb
, mem_flags
);
589 std
->bounce_buf
= kmalloc(max_std_len
, mem_flags
);
590 if (std
->bounce_buf
== NULL
)
593 std
->bounce_offset
= orig
- sg_virt(sg
);
594 bounce
= std
->bounce_buf
;
598 len
= min(sg_remaining
, max_std_len
- std
->len
);
601 memcpy(bounce
, orig
, len
);
604 std
->ntds_remaining
= -1; /* filled in later */
614 * For each of the new sTDs, map the bounce buffers, create
615 * page lists (if necessary), and fill in std->ntds_remaining.
617 list_for_each_entry(std
, &qset
->stds
, list_node
) {
618 if (std
->ntds_remaining
!= -1)
621 std
->dma_addr
= dma_map_single(&whc
->umc
->dev
, std
->bounce_buf
, std
->len
,
622 is_out
? DMA_TO_DEVICE
: DMA_FROM_DEVICE
);
623 if (dma_mapping_error(&whc
->umc
->dev
, std
->dma_addr
))
626 if (qset_fill_page_list(whc
, std
, mem_flags
) < 0)
629 std
->ntds_remaining
= ntds
--;
636 * qset_add_urb - add an urb to the qset's queue.
638 * The URB is chopped into sTDs, one for each qTD that will required.
639 * At least one qTD (and sTD) is required even if the transfer has no
640 * data (e.g., for some control transfers).
642 int qset_add_urb(struct whc
*whc
, struct whc_qset
*qset
, struct urb
*urb
,
645 struct whc_urb
*wurb
;
646 int remaining
= urb
->transfer_buffer_length
;
647 u64 transfer_dma
= urb
->transfer_dma
;
651 wurb
= kzalloc(sizeof(struct whc_urb
), mem_flags
);
657 INIT_WORK(&wurb
->dequeue_work
, urb_dequeue_work
);
660 ret
= qset_add_urb_sg(whc
, qset
, urb
, mem_flags
);
661 if (ret
== -EINVAL
) {
662 qset_free_stds(qset
, urb
);
663 ret
= qset_add_urb_sg_linearize(whc
, qset
, urb
, mem_flags
);
670 ntds_remaining
= DIV_ROUND_UP(remaining
, QTD_MAX_XFER_SIZE
);
671 if (ntds_remaining
== 0)
674 while (ntds_remaining
) {
679 if (std_len
> QTD_MAX_XFER_SIZE
)
680 std_len
= QTD_MAX_XFER_SIZE
;
682 std
= qset_new_std(whc
, qset
, urb
, mem_flags
);
686 std
->dma_addr
= transfer_dma
;
688 std
->ntds_remaining
= ntds_remaining
;
690 if (qset_fill_page_list(whc
, std
, mem_flags
) < 0)
694 remaining
-= std_len
;
695 transfer_dma
+= std_len
;
701 qset_free_stds(qset
, urb
);
706 * qset_remove_urb - remove an URB from the urb queue.
708 * The URB is returned to the USB subsystem.
710 void qset_remove_urb(struct whc
*whc
, struct whc_qset
*qset
,
711 struct urb
*urb
, int status
)
713 struct wusbhc
*wusbhc
= &whc
->wusbhc
;
714 struct whc_urb
*wurb
= urb
->hcpriv
;
716 usb_hcd_unlink_urb_from_ep(&wusbhc
->usb_hcd
, urb
);
717 /* Drop the lock as urb->complete() may enqueue another urb. */
718 spin_unlock(&whc
->lock
);
719 wusbhc_giveback_urb(wusbhc
, urb
, status
);
720 spin_lock(&whc
->lock
);
726 * get_urb_status_from_qtd - get the completed urb status from qTD status
727 * @urb: completed urb
728 * @status: qTD status
730 static int get_urb_status_from_qtd(struct urb
*urb
, u32 status
)
732 if (status
& QTD_STS_HALTED
) {
733 if (status
& QTD_STS_DBE
)
734 return usb_pipein(urb
->pipe
) ? -ENOSR
: -ECOMM
;
735 else if (status
& QTD_STS_BABBLE
)
737 else if (status
& QTD_STS_RCE
)
741 if (usb_pipein(urb
->pipe
)
742 && (urb
->transfer_flags
& URB_SHORT_NOT_OK
)
743 && urb
->actual_length
< urb
->transfer_buffer_length
)
749 * process_inactive_qtd - process an inactive (but not halted) qTD.
751 * Update the urb with the transfer bytes from the qTD, if the urb is
752 * completely transferred or (in the case of an IN only) the LPF is
753 * set, then the transfer is complete and the urb should be returned
756 void process_inactive_qtd(struct whc
*whc
, struct whc_qset
*qset
,
759 struct whc_std
*std
= list_first_entry(&qset
->stds
, struct whc_std
, list_node
);
760 struct urb
*urb
= std
->urb
;
764 status
= le32_to_cpu(qtd
->status
);
766 urb
->actual_length
+= std
->len
- QTD_STS_TO_LEN(status
);
768 if (usb_pipein(urb
->pipe
) && (status
& QTD_STS_LAST_PKT
))
771 complete
= whc_std_last(std
);
773 qset_remove_qtd(whc
, qset
);
774 qset_free_std(whc
, std
);
777 * Transfers for this URB are complete? Then return it to the
781 qset_remove_qtds(whc
, qset
, urb
);
782 qset_remove_urb(whc
, qset
, urb
, get_urb_status_from_qtd(urb
, status
));
785 * If iAlt isn't valid then the hardware didn't
786 * advance iCur. Adjust the start and end pointers to
789 if (!(status
& QTD_STS_IALT_VALID
))
790 qset
->td_start
= qset
->td_end
791 = QH_STATUS_TO_ICUR(le16_to_cpu(qset
->qh
.status
));
792 qset
->pause_after_urb
= NULL
;
797 * process_halted_qtd - process a qset with a halted qtd
799 * Remove all the qTDs for the failed URB and return the failed URB to
800 * the USB subsystem. Then remove all other qTDs so the qset can be
803 * FIXME: this is the point where rate adaptation can be done. If a
804 * transfer failed because it exceeded the maximum number of retries
805 * then it could be reactivated with a slower rate without having to
808 void process_halted_qtd(struct whc
*whc
, struct whc_qset
*qset
,
811 struct whc_std
*std
= list_first_entry(&qset
->stds
, struct whc_std
, list_node
);
812 struct urb
*urb
= std
->urb
;
815 urb_status
= get_urb_status_from_qtd(urb
, le32_to_cpu(qtd
->status
));
817 qset_remove_qtds(whc
, qset
, urb
);
818 qset_remove_urb(whc
, qset
, urb
, urb_status
);
820 list_for_each_entry(std
, &qset
->stds
, list_node
) {
823 qset_remove_qtd(whc
, qset
);
830 void qset_free(struct whc
*whc
, struct whc_qset
*qset
)
832 dma_pool_free(whc
->qset_pool
, qset
, qset
->qset_dma
);
836 * qset_delete - wait for a qset to be unused, then free it.
838 void qset_delete(struct whc
*whc
, struct whc_qset
*qset
)
840 wait_for_completion(&qset
->remove_complete
);
841 qset_free(whc
, qset
);