diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-07-29 16:11:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 19:23:04 -0400 |
commit | b375a0495fd622037560c73c05f23ae6f127bb0c (patch) | |
tree | 7f800cfd288480625e6e9886b51aa6d159a1548e | |
parent | a4e628328ec60873fec9d506d682155391f589ce (diff) |
[PATCH] USB: URB_ASYNC_UNLINK flag removed from the kernel
29 July 2005, Cambridge, MA:
This afternoon Alan Stern submitted a patch to remove the URB_ASYNC_UNLINK
flag from the Linux kernel. Mr. Stern explained, "This flag is a relic
from an earlier, less-well-designed system. For over a year it hasn't
been used for anything other than printing warning messages."
An anonymous spokesman for the Linux kernel development community
commented, "This is exactly the sort of thing we see happening all the
time. As the kernel evolves, support for old techniques and old code can
be jettisoned and replaced by newer, better approaches. Proprietary
operating systems do not have the freedom or flexibility to change so
quickly."
Mr. Stern, a staff member at Harvard University's Rowland Institute who
works on Linux only as a hobby, noted that the patch (labelled as548) did
not update two files, keyspan.c and option.c, in the USB drivers' "serial"
subdirectory. "Those files need more extensive changes," he remarked.
"They examine the status field of several URBs at times when they're not
supposed to. That will need to be fixed before the URB_ASYNC_UNLINK flag
is removed."
Greg Kroah-Hartman, the kernel maintainer responsible for overseeing all
of Linux's USB drivers, did not respond to our inquiries or return our
calls. His only comment was "Applied, thanks."
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/block/ub.c | 8 | ||||
-rw-r--r-- | drivers/net/irda/irda-usb.c | 13 | ||||
-rw-r--r-- | drivers/usb/atm/cxacru.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 26 | ||||
-rw-r--r-- | drivers/usb/input/hid-core.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/auerswald.c | 3 | ||||
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/usbtest.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/catc.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/kaweth.c | 1 | ||||
-rw-r--r-- | drivers/usb/net/pegasus.c | 1 | ||||
-rw-r--r-- | drivers/usb/net/rtl8150.c | 1 | ||||
-rw-r--r-- | drivers/usb/net/usbnet.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/zd1201.c | 1 | ||||
-rw-r--r-- | drivers/usb/storage/transport.c | 7 | ||||
-rw-r--r-- | include/linux/usb.h | 9 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 10 |
18 files changed, 25 insertions, 77 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 57d3279a8815..aa0bf7ee008d 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1010,7 +1010,7 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1010 | sc->last_pipe = sc->send_bulk_pipe; | 1010 | sc->last_pipe = sc->send_bulk_pipe; |
1011 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, | 1011 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, |
1012 | bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); | 1012 | bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); |
1013 | sc->work_urb.transfer_flags = URB_ASYNC_UNLINK; | 1013 | sc->work_urb.transfer_flags = 0; |
1014 | 1014 | ||
1015 | /* Fill what we shouldn't be filling, because usb-storage did so. */ | 1015 | /* Fill what we shouldn't be filling, because usb-storage did so. */ |
1016 | sc->work_urb.actual_length = 0; | 1016 | sc->work_urb.actual_length = 0; |
@@ -1395,7 +1395,7 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1395 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, | 1395 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, |
1396 | page_address(sg->page) + sg->offset, sg->length, | 1396 | page_address(sg->page) + sg->offset, sg->length, |
1397 | ub_urb_complete, sc); | 1397 | ub_urb_complete, sc); |
1398 | sc->work_urb.transfer_flags = URB_ASYNC_UNLINK; | 1398 | sc->work_urb.transfer_flags = 0; |
1399 | sc->work_urb.actual_length = 0; | 1399 | sc->work_urb.actual_length = 0; |
1400 | sc->work_urb.error_count = 0; | 1400 | sc->work_urb.error_count = 0; |
1401 | sc->work_urb.status = 0; | 1401 | sc->work_urb.status = 0; |
@@ -1442,7 +1442,7 @@ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1442 | sc->last_pipe = sc->recv_bulk_pipe; | 1442 | sc->last_pipe = sc->recv_bulk_pipe; |
1443 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, | 1443 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, |
1444 | &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); | 1444 | &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); |
1445 | sc->work_urb.transfer_flags = URB_ASYNC_UNLINK; | 1445 | sc->work_urb.transfer_flags = 0; |
1446 | sc->work_urb.actual_length = 0; | 1446 | sc->work_urb.actual_length = 0; |
1447 | sc->work_urb.error_count = 0; | 1447 | sc->work_urb.error_count = 0; |
1448 | sc->work_urb.status = 0; | 1448 | sc->work_urb.status = 0; |
@@ -1563,7 +1563,7 @@ static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, | |||
1563 | 1563 | ||
1564 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, | 1564 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, |
1565 | (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); | 1565 | (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); |
1566 | sc->work_urb.transfer_flags = URB_ASYNC_UNLINK; | 1566 | sc->work_urb.transfer_flags = 0; |
1567 | sc->work_urb.actual_length = 0; | 1567 | sc->work_urb.actual_length = 0; |
1568 | sc->work_urb.error_count = 0; | 1568 | sc->work_urb.error_count = 0; |
1569 | sc->work_urb.status = 0; | 1569 | sc->work_urb.status = 0; |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 46e0022d3258..6c766fdc51a6 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -267,7 +267,7 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) | |||
267 | frame, IRDA_USB_SPEED_MTU, | 267 | frame, IRDA_USB_SPEED_MTU, |
268 | speed_bulk_callback, self); | 268 | speed_bulk_callback, self); |
269 | urb->transfer_buffer_length = USB_IRDA_HEADER; | 269 | urb->transfer_buffer_length = USB_IRDA_HEADER; |
270 | urb->transfer_flags = URB_ASYNC_UNLINK; | 270 | urb->transfer_flags = 0; |
271 | 271 | ||
272 | /* Irq disabled -> GFP_ATOMIC */ | 272 | /* Irq disabled -> GFP_ATOMIC */ |
273 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { | 273 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { |
@@ -401,15 +401,12 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
401 | skb->data, IRDA_SKB_MAX_MTU, | 401 | skb->data, IRDA_SKB_MAX_MTU, |
402 | write_bulk_callback, skb); | 402 | write_bulk_callback, skb); |
403 | urb->transfer_buffer_length = skb->len; | 403 | urb->transfer_buffer_length = skb->len; |
404 | /* Note : unlink *must* be Asynchronous because of the code in | ||
405 | * irda_usb_net_timeout() -> call in irq - Jean II */ | ||
406 | urb->transfer_flags = URB_ASYNC_UNLINK; | ||
407 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not | 404 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not |
408 | * a continuous stream of data but separate packets. | 405 | * a continuous stream of data but separate packets. |
409 | * In this case, the USB layer will insert an empty USB frame (TD) | 406 | * In this case, the USB layer will insert an empty USB frame (TD) |
410 | * after each of our packets that is exact multiple of the frame size. | 407 | * after each of our packets that is exact multiple of the frame size. |
411 | * This is how the dongle will detect the end of packet - Jean II */ | 408 | * This is how the dongle will detect the end of packet - Jean II */ |
412 | urb->transfer_flags |= URB_ZERO_PACKET; | 409 | urb->transfer_flags = URB_ZERO_PACKET; |
413 | 410 | ||
414 | /* Generate min turn time. FIXME: can we do better than this? */ | 411 | /* Generate min turn time. FIXME: can we do better than this? */ |
415 | /* Trying to a turnaround time at this level is trying to measure | 412 | /* Trying to a turnaround time at this level is trying to measure |
@@ -630,8 +627,6 @@ static void irda_usb_net_timeout(struct net_device *netdev) | |||
630 | * in completion handler, because urb->status will | 627 | * in completion handler, because urb->status will |
631 | * be -ENOENT. We will fix that at the next watchdog, | 628 | * be -ENOENT. We will fix that at the next watchdog, |
632 | * leaving more time to USB to recover... | 629 | * leaving more time to USB to recover... |
633 | * Also, we are in interrupt, so we need to have | ||
634 | * URB_ASYNC_UNLINK to work properly... | ||
635 | * Jean II */ | 630 | * Jean II */ |
636 | done = 1; | 631 | done = 1; |
637 | break; | 632 | break; |
@@ -1008,9 +1003,7 @@ static int irda_usb_net_close(struct net_device *netdev) | |||
1008 | } | 1003 | } |
1009 | } | 1004 | } |
1010 | /* Cancel Tx and speed URB - need to be synchronous to avoid races */ | 1005 | /* Cancel Tx and speed URB - need to be synchronous to avoid races */ |
1011 | self->tx_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1012 | usb_kill_urb(self->tx_urb); | 1006 | usb_kill_urb(self->tx_urb); |
1013 | self->speed_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1014 | usb_kill_urb(self->speed_urb); | 1007 | usb_kill_urb(self->speed_urb); |
1015 | 1008 | ||
1016 | /* Stop and remove instance of IrLAP */ | 1009 | /* Stop and remove instance of IrLAP */ |
@@ -1521,9 +1514,7 @@ static void irda_usb_disconnect(struct usb_interface *intf) | |||
1521 | usb_kill_urb(self->rx_urb[i]); | 1514 | usb_kill_urb(self->rx_urb[i]); |
1522 | /* Cancel Tx and speed URB. | 1515 | /* Cancel Tx and speed URB. |
1523 | * Toggle flags to make sure it's synchronous. */ | 1516 | * Toggle flags to make sure it's synchronous. */ |
1524 | self->tx_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1525 | usb_kill_urb(self->tx_urb); | 1517 | usb_kill_urb(self->tx_urb); |
1526 | self->speed_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1527 | usb_kill_urb(self->speed_urb); | 1518 | usb_kill_urb(self->speed_urb); |
1528 | } | 1519 | } |
1529 | 1520 | ||
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 8e184e2641cb..79861ee12a29 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -715,13 +715,11 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, | |||
715 | usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD), | 715 | usb_dev, usb_rcvintpipe(usb_dev, CXACRU_EP_CMD), |
716 | instance->rcv_buf, PAGE_SIZE, | 716 | instance->rcv_buf, PAGE_SIZE, |
717 | cxacru_blocking_completion, &instance->rcv_done, 1); | 717 | cxacru_blocking_completion, &instance->rcv_done, 1); |
718 | instance->rcv_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
719 | 718 | ||
720 | usb_fill_int_urb(instance->snd_urb, | 719 | usb_fill_int_urb(instance->snd_urb, |
721 | usb_dev, usb_sndintpipe(usb_dev, CXACRU_EP_CMD), | 720 | usb_dev, usb_sndintpipe(usb_dev, CXACRU_EP_CMD), |
722 | instance->snd_buf, PAGE_SIZE, | 721 | instance->snd_buf, PAGE_SIZE, |
723 | cxacru_blocking_completion, &instance->snd_done, 4); | 722 | cxacru_blocking_completion, &instance->snd_done, 4); |
724 | instance->snd_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
725 | 723 | ||
726 | init_MUTEX(&instance->cm_serialize); | 724 | init_MUTEX(&instance->cm_serialize); |
727 | 725 | ||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 88d1b376f67c..74197249c245 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -48,7 +48,6 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length) | |||
48 | 48 | ||
49 | init_completion(&done); | 49 | init_completion(&done); |
50 | urb->context = &done; | 50 | urb->context = &done; |
51 | urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
52 | urb->actual_length = 0; | 51 | urb->actual_length = 0; |
53 | status = usb_submit_urb(urb, GFP_NOIO); | 52 | status = usb_submit_urb(urb, GFP_NOIO); |
54 | 53 | ||
@@ -357,8 +356,7 @@ int usb_sg_init ( | |||
357 | if (!io->urbs) | 356 | if (!io->urbs) |
358 | goto nomem; | 357 | goto nomem; |
359 | 358 | ||
360 | urb_flags = URB_ASYNC_UNLINK | URB_NO_TRANSFER_DMA_MAP | 359 | urb_flags = URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT; |
361 | | URB_NO_INTERRUPT; | ||
362 | if (usb_pipein (pipe)) | 360 | if (usb_pipein (pipe)) |
363 | urb_flags |= URB_SHORT_NOT_OK; | 361 | urb_flags |= URB_SHORT_NOT_OK; |
364 | 362 | ||
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index c0feee25ff0a..c846fefb7386 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -309,9 +309,8 @@ int usb_submit_urb(struct urb *urb, unsigned mem_flags) | |||
309 | unsigned int allowed; | 309 | unsigned int allowed; |
310 | 310 | ||
311 | /* enforce simple/standard policy */ | 311 | /* enforce simple/standard policy */ |
312 | allowed = URB_ASYNC_UNLINK; // affects later unlinks | 312 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | |
313 | allowed |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); | 313 | URB_NO_INTERRUPT); |
314 | allowed |= URB_NO_INTERRUPT; | ||
315 | switch (temp) { | 314 | switch (temp) { |
316 | case PIPE_BULK: | 315 | case PIPE_BULK: |
317 | if (is_out) | 316 | if (is_out) |
@@ -400,14 +399,8 @@ int usb_submit_urb(struct urb *urb, unsigned mem_flags) | |||
400 | * canceled (rather than any other code) and will quickly be removed | 399 | * canceled (rather than any other code) and will quickly be removed |
401 | * from host controller data structures. | 400 | * from host controller data structures. |
402 | * | 401 | * |
403 | * In the past, clearing the URB_ASYNC_UNLINK transfer flag for the | 402 | * This request is always asynchronous. |
404 | * URB indicated that the request was synchronous. This usage is now | 403 | * Success is indicated by returning -EINPROGRESS, |
405 | * deprecated; if the flag is clear the call will be forwarded to | ||
406 | * usb_kill_urb() and the return value will be 0. In the future, drivers | ||
407 | * should call usb_kill_urb() directly for synchronous unlinking. | ||
408 | * | ||
409 | * When the URB_ASYNC_UNLINK transfer flag for the URB is set, this | ||
410 | * request is asynchronous. Success is indicated by returning -EINPROGRESS, | ||
411 | * at which time the URB will normally have been unlinked but not yet | 404 | * at which time the URB will normally have been unlinked but not yet |
412 | * given back to the device driver. When it is called, the completion | 405 | * given back to the device driver. When it is called, the completion |
413 | * function will see urb->status == -ECONNRESET. Failure is indicated | 406 | * function will see urb->status == -ECONNRESET. Failure is indicated |
@@ -453,17 +446,6 @@ int usb_unlink_urb(struct urb *urb) | |||
453 | { | 446 | { |
454 | if (!urb) | 447 | if (!urb) |
455 | return -EINVAL; | 448 | return -EINVAL; |
456 | if (!(urb->transfer_flags & URB_ASYNC_UNLINK)) { | ||
457 | #ifdef CONFIG_DEBUG_KERNEL | ||
458 | if (printk_ratelimit()) { | ||
459 | printk(KERN_NOTICE "usb_unlink_urb() is deprecated for " | ||
460 | "synchronous unlinks. Use usb_kill_urb() instead.\n"); | ||
461 | WARN_ON(1); | ||
462 | } | ||
463 | #endif | ||
464 | usb_kill_urb(urb); | ||
465 | return 0; | ||
466 | } | ||
467 | if (!(urb->dev && urb->dev->bus && urb->dev->bus->op)) | 449 | if (!(urb->dev && urb->dev->bus && urb->dev->bus->op)) |
468 | return -ENODEV; | 450 | return -ENODEV; |
469 | return urb->dev->bus->op->unlink_urb(urb, -ECONNRESET); | 451 | return urb->dev->bus->op->unlink_urb(urb, -ECONNRESET); |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 719c0316cc39..1ab95d24c5e2 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1688,7 +1688,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1688 | usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0, | 1688 | usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0, |
1689 | hid_irq_in, hid, interval); | 1689 | hid_irq_in, hid, interval); |
1690 | hid->urbin->transfer_dma = hid->inbuf_dma; | 1690 | hid->urbin->transfer_dma = hid->inbuf_dma; |
1691 | hid->urbin->transfer_flags |=(URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); | 1691 | hid->urbin->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1692 | } else { | 1692 | } else { |
1693 | if (hid->urbout) | 1693 | if (hid->urbout) |
1694 | continue; | 1694 | continue; |
@@ -1698,7 +1698,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1698 | usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 0, | 1698 | usb_fill_int_urb(hid->urbout, dev, pipe, hid->outbuf, 0, |
1699 | hid_irq_out, hid, interval); | 1699 | hid_irq_out, hid, interval); |
1700 | hid->urbout->transfer_dma = hid->outbuf_dma; | 1700 | hid->urbout->transfer_dma = hid->outbuf_dma; |
1701 | hid->urbout->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); | 1701 | hid->urbout->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1702 | } | 1702 | } |
1703 | } | 1703 | } |
1704 | 1704 | ||
@@ -1750,7 +1750,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1750 | hid->ctrlbuf, 1, hid_ctrl, hid); | 1750 | hid->ctrlbuf, 1, hid_ctrl, hid); |
1751 | hid->urbctrl->setup_dma = hid->cr_dma; | 1751 | hid->urbctrl->setup_dma = hid->cr_dma; |
1752 | hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; | 1752 | hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; |
1753 | hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | URB_ASYNC_UNLINK); | 1753 | hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); |
1754 | 1754 | ||
1755 | return hid; | 1755 | return hid; |
1756 | 1756 | ||
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 6f7994f5a714..ae4681f9f0ea 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c | |||
@@ -426,7 +426,7 @@ static int auerchain_submit_urb (pauerchain_t acp, struct urb * urb) | |||
426 | 426 | ||
427 | /* cancel an urb which is submitted to the chain | 427 | /* cancel an urb which is submitted to the chain |
428 | the result is 0 if the urb is cancelled, or -EINPROGRESS if | 428 | the result is 0 if the urb is cancelled, or -EINPROGRESS if |
429 | URB_ASYNC_UNLINK is set and the function is successfully started. | 429 | the function is successfully started. |
430 | */ | 430 | */ |
431 | static int auerchain_unlink_urb (pauerchain_t acp, struct urb * urb) | 431 | static int auerchain_unlink_urb (pauerchain_t acp, struct urb * urb) |
432 | { | 432 | { |
@@ -515,7 +515,6 @@ static void auerchain_unlink_all (pauerchain_t acp) | |||
515 | acep = acp->active; | 515 | acep = acp->active; |
516 | if (acep) { | 516 | if (acep) { |
517 | urbp = acep->urbp; | 517 | urbp = acep->urbp; |
518 | urbp->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
519 | dbg ("unlink active urb"); | 518 | dbg ("unlink active urb"); |
520 | usb_kill_urb (urbp); | 519 | usb_kill_urb (urbp); |
521 | } | 520 | } |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 2fd12264fd53..d63ce6c030f3 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -229,7 +229,7 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, | |||
229 | usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, | 229 | usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, |
230 | sisusb_bulk_completeout, &sisusb->urbout_context[index]); | 230 | sisusb_bulk_completeout, &sisusb->urbout_context[index]); |
231 | 231 | ||
232 | urb->transfer_flags |= (tflags | URB_ASYNC_UNLINK); | 232 | urb->transfer_flags |= tflags; |
233 | urb->actual_length = 0; | 233 | urb->actual_length = 0; |
234 | 234 | ||
235 | if ((urb->transfer_dma = transfer_dma)) | 235 | if ((urb->transfer_dma = transfer_dma)) |
@@ -295,7 +295,7 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, | |||
295 | usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, | 295 | usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, |
296 | sisusb_bulk_completein, sisusb); | 296 | sisusb_bulk_completein, sisusb); |
297 | 297 | ||
298 | urb->transfer_flags |= (tflags | URB_ASYNC_UNLINK); | 298 | urb->transfer_flags |= tflags; |
299 | urb->actual_length = 0; | 299 | urb->actual_length = 0; |
300 | 300 | ||
301 | if ((urb->transfer_dma = transfer_dma)) | 301 | if ((urb->transfer_dma = transfer_dma)) |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index fd7fb98e4b20..54799eb0bc60 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -986,7 +986,6 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param) | |||
986 | 986 | ||
987 | u->context = &context; | 987 | u->context = &context; |
988 | u->complete = ctrl_complete; | 988 | u->complete = ctrl_complete; |
989 | u->transfer_flags |= URB_ASYNC_UNLINK; | ||
990 | } | 989 | } |
991 | 990 | ||
992 | /* queue the urbs */ | 991 | /* queue the urbs */ |
@@ -1052,7 +1051,6 @@ static int unlink1 (struct usbtest_dev *dev, int pipe, int size, int async) | |||
1052 | urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size); | 1051 | urb = simple_alloc_urb (testdev_to_usbdev (dev), pipe, size); |
1053 | if (!urb) | 1052 | if (!urb) |
1054 | return -ENOMEM; | 1053 | return -ENOMEM; |
1055 | urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
1056 | urb->context = &completion; | 1054 | urb->context = &completion; |
1057 | urb->complete = unlink1_callback; | 1055 | urb->complete = unlink1_callback; |
1058 | 1056 | ||
diff --git a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c index c8be912f24e1..37ef365a2472 100644 --- a/drivers/usb/net/catc.c +++ b/drivers/usb/net/catc.c | |||
@@ -383,7 +383,6 @@ static void catc_tx_done(struct urb *urb, struct pt_regs *regs) | |||
383 | 383 | ||
384 | if (urb->status == -ECONNRESET) { | 384 | if (urb->status == -ECONNRESET) { |
385 | dbg("Tx Reset."); | 385 | dbg("Tx Reset."); |
386 | urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
387 | urb->status = 0; | 386 | urb->status = 0; |
388 | catc->netdev->trans_start = jiffies; | 387 | catc->netdev->trans_start = jiffies; |
389 | catc->stats.tx_errors++; | 388 | catc->stats.tx_errors++; |
@@ -445,7 +444,6 @@ static void catc_tx_timeout(struct net_device *netdev) | |||
445 | struct catc *catc = netdev_priv(netdev); | 444 | struct catc *catc = netdev_priv(netdev); |
446 | 445 | ||
447 | warn("Transmit timed out."); | 446 | warn("Transmit timed out."); |
448 | catc->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
449 | usb_unlink_urb(catc->tx_urb); | 447 | usb_unlink_urb(catc->tx_urb); |
450 | } | 448 | } |
451 | 449 | ||
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index 7ffa99b9760f..e04b0ce3611a 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c | |||
@@ -787,7 +787,6 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
787 | kaweth_usb_transmit_complete, | 787 | kaweth_usb_transmit_complete, |
788 | kaweth); | 788 | kaweth); |
789 | kaweth->end = 0; | 789 | kaweth->end = 0; |
790 | kaweth->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
791 | 790 | ||
792 | if((res = usb_submit_urb(kaweth->tx_urb, GFP_ATOMIC))) | 791 | if((res = usb_submit_urb(kaweth->tx_urb, GFP_ATOMIC))) |
793 | { | 792 | { |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index fcd6d3ccef44..7484d34780fc 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -825,7 +825,6 @@ static void pegasus_tx_timeout(struct net_device *net) | |||
825 | pegasus_t *pegasus = netdev_priv(net); | 825 | pegasus_t *pegasus = netdev_priv(net); |
826 | if (netif_msg_timer(pegasus)) | 826 | if (netif_msg_timer(pegasus)) |
827 | printk(KERN_WARNING "%s: tx timeout\n", net->name); | 827 | printk(KERN_WARNING "%s: tx timeout\n", net->name); |
828 | pegasus->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
829 | usb_unlink_urb(pegasus->tx_urb); | 828 | usb_unlink_urb(pegasus->tx_urb); |
830 | pegasus->stats.tx_errors++; | 829 | pegasus->stats.tx_errors++; |
831 | } | 830 | } |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 59ab40ebb394..c3d4e3589e30 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -653,7 +653,6 @@ static void rtl8150_tx_timeout(struct net_device *netdev) | |||
653 | { | 653 | { |
654 | rtl8150_t *dev = netdev_priv(netdev); | 654 | rtl8150_t *dev = netdev_priv(netdev); |
655 | warn("%s: Tx timeout.", netdev->name); | 655 | warn("%s: Tx timeout.", netdev->name); |
656 | dev->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
657 | usb_unlink_urb(dev->tx_urb); | 656 | usb_unlink_urb(dev->tx_urb); |
658 | dev->stats.tx_errors++; | 657 | dev->stats.tx_errors++; |
659 | } | 658 | } |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 4682696450db..3c6eef4168e5 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -2987,7 +2987,6 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, unsigned flags) | |||
2987 | 2987 | ||
2988 | usb_fill_bulk_urb (urb, dev->udev, dev->in, | 2988 | usb_fill_bulk_urb (urb, dev->udev, dev->in, |
2989 | skb->data, size, rx_complete, skb); | 2989 | skb->data, size, rx_complete, skb); |
2990 | urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
2991 | 2990 | ||
2992 | spin_lock_irqsave (&dev->rxq.lock, lockflags); | 2991 | spin_lock_irqsave (&dev->rxq.lock, lockflags); |
2993 | 2992 | ||
@@ -3561,7 +3560,6 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net) | |||
3561 | 3560 | ||
3562 | usb_fill_bulk_urb (urb, dev->udev, dev->out, | 3561 | usb_fill_bulk_urb (urb, dev->udev, dev->out, |
3563 | skb->data, skb->len, tx_complete, skb); | 3562 | skb->data, skb->len, tx_complete, skb); |
3564 | urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
3565 | 3563 | ||
3566 | /* don't assume the hardware handles USB_ZERO_PACKET | 3564 | /* don't assume the hardware handles USB_ZERO_PACKET |
3567 | * NOTE: strictly conforming cdc-ether devices should expect | 3565 | * NOTE: strictly conforming cdc-ether devices should expect |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index fc013978837e..c4e479ee926a 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -847,7 +847,6 @@ static void zd1201_tx_timeout(struct net_device *dev) | |||
847 | return; | 847 | return; |
848 | dev_warn(&zd->usb->dev, "%s: TX timeout, shooting down urb\n", | 848 | dev_warn(&zd->usb->dev, "%s: TX timeout, shooting down urb\n", |
849 | dev->name); | 849 | dev->name); |
850 | zd->tx_urb->transfer_flags |= URB_ASYNC_UNLINK; | ||
851 | usb_unlink_urb(zd->tx_urb); | 850 | usb_unlink_urb(zd->tx_urb); |
852 | zd->stats.tx_errors++; | 851 | zd->stats.tx_errors++; |
853 | /* Restart the timeout to quiet the watchdog: */ | 852 | /* Restart the timeout to quiet the watchdog: */ |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index e42875152c34..c1ba5301ebfc 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -96,8 +96,8 @@ | |||
96 | * or before the URB_ACTIVE bit was set. If so, it's essential to cancel | 96 | * or before the URB_ACTIVE bit was set. If so, it's essential to cancel |
97 | * the URB if it hasn't been cancelled already (i.e., if the URB_ACTIVE bit | 97 | * the URB if it hasn't been cancelled already (i.e., if the URB_ACTIVE bit |
98 | * is still set). Either way, the function must then wait for the URB to | 98 | * is still set). Either way, the function must then wait for the URB to |
99 | * finish. Note that because the URB_ASYNC_UNLINK flag is set, the URB can | 99 | * finish. Note that the URB can still be in progress even after a call to |
100 | * still be in progress even after a call to usb_unlink_urb() returns. | 100 | * usb_unlink_urb() returns. |
101 | * | 101 | * |
102 | * The idea is that (1) once the ABORTING or DISCONNECTING bit is set, | 102 | * The idea is that (1) once the ABORTING or DISCONNECTING bit is set, |
103 | * either the stop_transport() function or the submitting function | 103 | * either the stop_transport() function or the submitting function |
@@ -158,8 +158,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
158 | * hasn't been mapped for DMA. Yes, this is clunky, but it's | 158 | * hasn't been mapped for DMA. Yes, this is clunky, but it's |
159 | * easier than always having the caller tell us whether the | 159 | * easier than always having the caller tell us whether the |
160 | * transfer buffer has already been mapped. */ | 160 | * transfer buffer has already been mapped. */ |
161 | us->current_urb->transfer_flags = | 161 | us->current_urb->transfer_flags = URB_NO_SETUP_DMA_MAP; |
162 | URB_ASYNC_UNLINK | URB_NO_SETUP_DMA_MAP; | ||
163 | if (us->current_urb->transfer_buffer == us->iobuf) | 162 | if (us->current_urb->transfer_buffer == us->iobuf) |
164 | us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 163 | us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
165 | us->current_urb->transfer_dma = us->iobuf_dma; | 164 | us->current_urb->transfer_dma = us->iobuf_dma; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 434e35120c65..4dbe580f9335 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -616,7 +616,6 @@ extern int usb_disabled(void); | |||
616 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ | 616 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ |
617 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ | 617 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ |
618 | #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ | 618 | #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ |
619 | #define URB_ASYNC_UNLINK 0x0010 /* usb_unlink_urb() returns asap */ | ||
620 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ | 619 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ |
621 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ | 620 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ |
622 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ | 621 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ |
@@ -724,13 +723,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *); | |||
724 | * Initialization: | 723 | * Initialization: |
725 | * | 724 | * |
726 | * All URBs submitted must initialize the dev, pipe, transfer_flags (may be | 725 | * All URBs submitted must initialize the dev, pipe, transfer_flags (may be |
727 | * zero), and complete fields. | 726 | * zero), and complete fields. All URBs must also initialize |
728 | * The URB_ASYNC_UNLINK transfer flag affects later invocations of | ||
729 | * the usb_unlink_urb() routine. Note: Failure to set URB_ASYNC_UNLINK | ||
730 | * with usb_unlink_urb() is deprecated. For synchronous unlinks use | ||
731 | * usb_kill_urb() instead. | ||
732 | * | ||
733 | * All URBs must also initialize | ||
734 | * transfer_buffer and transfer_buffer_length. They may provide the | 727 | * transfer_buffer and transfer_buffer_length. They may provide the |
735 | * URB_SHORT_NOT_OK transfer flag, indicating that short reads are | 728 | * URB_SHORT_NOT_OK transfer flag, indicating that short reads are |
736 | * to be treated as errors; that flag is invalid for write requests. | 729 | * to be treated as errors; that flag is invalid for write requests. |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 5aa5fe651a8a..bfbec5876659 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -735,10 +735,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) | |||
735 | if (test_bit(i, &subs->active_mask)) { | 735 | if (test_bit(i, &subs->active_mask)) { |
736 | if (! test_and_set_bit(i, &subs->unlink_mask)) { | 736 | if (! test_and_set_bit(i, &subs->unlink_mask)) { |
737 | struct urb *u = subs->dataurb[i].urb; | 737 | struct urb *u = subs->dataurb[i].urb; |
738 | if (async) { | 738 | if (async) |
739 | u->transfer_flags |= URB_ASYNC_UNLINK; | ||
740 | usb_unlink_urb(u); | 739 | usb_unlink_urb(u); |
741 | } else | 740 | else |
742 | usb_kill_urb(u); | 741 | usb_kill_urb(u); |
743 | } | 742 | } |
744 | } | 743 | } |
@@ -748,10 +747,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) | |||
748 | if (test_bit(i+16, &subs->active_mask)) { | 747 | if (test_bit(i+16, &subs->active_mask)) { |
749 | if (! test_and_set_bit(i+16, &subs->unlink_mask)) { | 748 | if (! test_and_set_bit(i+16, &subs->unlink_mask)) { |
750 | struct urb *u = subs->syncurb[i].urb; | 749 | struct urb *u = subs->syncurb[i].urb; |
751 | if (async) { | 750 | if (async) |
752 | u->transfer_flags |= URB_ASYNC_UNLINK; | ||
753 | usb_unlink_urb(u); | 751 | usb_unlink_urb(u); |
754 | } else | 752 | else |
755 | usb_kill_urb(u); | 753 | usb_kill_urb(u); |
756 | } | 754 | } |
757 | } | 755 | } |