| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- --- a/drivers/net/wireless/ath/ar9170/usb.c
- +++ b/drivers/net/wireless/ath/ar9170/usb.c
- @@ -96,6 +96,225 @@ static struct usb_device_id ar9170_usb_i
- };
- MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
-
- +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
- +
- +/**
- + * usb_unpoison_anchored_urbs - let an anchor be used successfully again
- + * @anchor: anchor the requests are bound to
- + *
- + * Reverses the effect of usb_poison_anchored_urbs
- + * the anchor can be used normally after it returns
- + */
- +void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
- +{
- + unsigned long flags;
- + struct urb *lazarus;
- +
- + spin_lock_irqsave(&anchor->lock, flags);
- + list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
- + usb_unpoison_urb(lazarus);
- + }
- + //anchor->poisoned = 0; /* XXX: cannot backport */
- + spin_unlock_irqrestore(&anchor->lock, flags);
- +}
- +EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
- +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
- +
- +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
- +
- +/*
- + * Compat-wireless notes for USB backport stuff:
- + *
- + * urb->reject exists on 2.6.27, the poison/unpoison helpers
- + * did not though. The anchor poison does not exist so we cannot use them.
- + *
- + * USB anchor poising seems to exist to prevent future driver sumbissions
- + * of usb_anchor_urb() to an anchor marked as poisoned. For older kernels
- + * we cannot use that, so new usb_anchor_urb()s will be anchored. The down
- + * side to this should be submission of URBs will continue being anchored
- + * on an anchor instead of having them being rejected immediately when the
- + * driver realized we needed to stop. For ar9170 we poison URBs upon the
- + * ar9170 mac80211 stop callback(), don't think this should be so bad.
- + * It mean there is period of time in older kernels for which we continue
- + * to anchor new URBs to a known stopped anchor. We have two anchors
- + * (TX, and RX)
- + */
- +
- +#if 0
- +/**
- + * usb_poison_urb - reliably kill a transfer and prevent further use of an URB
- + * @urb: pointer to URB describing a previously submitted request,
- + * may be NULL
- + *
- + * This routine cancels an in-progress request. It is guaranteed that
- + * upon return all completion handlers will have finished and the URB
- + * will be totally idle and cannot be reused. These features make
- + * this an ideal way to stop I/O in a disconnect() callback.
- + * If the request has not already finished or been unlinked
- + * the completion handler will see urb->status == -ENOENT.
- + *
- + * After and while the routine runs, attempts to resubmit the URB will fail
- + * with error -EPERM. Thus even if the URB's completion handler always
- + * tries to resubmit, it will not succeed and the URB will become idle.
- + *
- + * This routine may not be used in an interrupt context (such as a bottom
- + * half or a completion handler), or when holding a spinlock, or in other
- + * situations where the caller can't schedule().
- + *
- + * This routine should not be called by a driver after its disconnect
- + * method has returned.
- + */
- +void usb_poison_urb(struct urb *urb)
- +{
- + might_sleep();
- + if (!(urb && urb->dev && urb->ep))
- + return;
- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- + spin_lock_irq(&usb_reject_lock);
- +#endif
- + ++urb->reject;
- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- + spin_unlock_irq(&usb_reject_lock);
- +#endif
- + /*
- + * XXX: usb_hcd_unlink_urb() needs backporting... this is defined
- + * on usb hcd.c but urb.c gets access to it. That is, older kernels
- + * have usb_hcd_unlink_urb() but its not exported, nor can we
- + * re-implement it exactly. This essentially dequeues the urb from
- + * hw, we need to figure out a way to backport this.
- + */
- + //usb_hcd_unlink_urb(urb, -ENOENT);
- +
- + wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
- +}
- +EXPORT_SYMBOL_GPL(usb_poison_urb);
- +#endif
- +
- +void usb_unpoison_urb(struct urb *urb)
- +{
- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- + unsigned long flags;
- +#endif
- +
- + if (!urb)
- + return;
- +
- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- + spin_lock_irqsave(&usb_reject_lock, flags);
- +#endif
- + --urb->reject;
- +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- + spin_unlock_irqrestore(&usb_reject_lock, flags);
- +#endif
- +}
- +EXPORT_SYMBOL_GPL(usb_unpoison_urb);
- +
- +
- +#if 0
- +/**
- + * usb_poison_anchored_urbs - cease all traffic from an anchor
- + * @anchor: anchor the requests are bound to
- + *
- + * this allows all outstanding URBs to be poisoned starting
- + * from the back of the queue. Newly added URBs will also be
- + * poisoned
- + *
- + * This routine should not be called by a driver after its disconnect
- + * method has returned.
- + */
- +void usb_poison_anchored_urbs(struct usb_anchor *anchor)
- +{
- + struct urb *victim;
- +
- + spin_lock_irq(&anchor->lock);
- + // anchor->poisoned = 1; /* XXX: Cannot backport */
- + while (!list_empty(&anchor->urb_list)) {
- + victim = list_entry(anchor->urb_list.prev, struct urb,
- + anchor_list);
- + /* we must make sure the URB isn't freed before we kill it*/
- + usb_get_urb(victim);
- + spin_unlock_irq(&anchor->lock);
- + /* this will unanchor the URB */
- + usb_poison_urb(victim);
- + usb_put_urb(victim);
- + spin_lock_irq(&anchor->lock);
- + }
- + spin_unlock_irq(&anchor->lock);
- +}
- +EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
- +#endif
- +
- +/**
- + * usb_get_from_anchor - get an anchor's oldest urb
- + * @anchor: the anchor whose urb you want
- + *
- + * this will take the oldest urb from an anchor,
- + * unanchor and return it
- + */
- +struct urb *usb_get_from_anchor(struct usb_anchor *anchor)
- +{
- + struct urb *victim;
- + unsigned long flags;
- +
- + spin_lock_irqsave(&anchor->lock, flags);
- + if (!list_empty(&anchor->urb_list)) {
- + victim = list_entry(anchor->urb_list.next, struct urb,
- + anchor_list);
- + usb_get_urb(victim);
- + spin_unlock_irqrestore(&anchor->lock, flags);
- + usb_unanchor_urb(victim);
- + } else {
- + spin_unlock_irqrestore(&anchor->lock, flags);
- + victim = NULL;
- + }
- +
- + return victim;
- +}
- +
- +EXPORT_SYMBOL_GPL(usb_get_from_anchor);
- +
- +/**
- + * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
- + * @anchor: the anchor whose urbs you want to unanchor
- + *
- + * use this to get rid of all an anchor's urbs
- + */
- +void usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
- +{
- + struct urb *victim;
- + unsigned long flags;
- +
- + spin_lock_irqsave(&anchor->lock, flags);
- + while (!list_empty(&anchor->urb_list)) {
- + victim = list_entry(anchor->urb_list.prev, struct urb,
- + anchor_list);
- + usb_get_urb(victim);
- + spin_unlock_irqrestore(&anchor->lock, flags);
- + /* this may free the URB */
- + usb_unanchor_urb(victim);
- + usb_put_urb(victim);
- + spin_lock_irqsave(&anchor->lock, flags);
- + }
- + spin_unlock_irqrestore(&anchor->lock, flags);
- +}
- +
- +EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs);
- +
- +/**
- + * usb_anchor_empty - is an anchor empty
- + * @anchor: the anchor you want to query
- + *
- + * returns 1 if the anchor has no urbs associated with it
- + */
- +int usb_anchor_empty(struct usb_anchor *anchor)
- +{
- + return list_empty(&anchor->urb_list);
- +}
- +
- +EXPORT_SYMBOL_GPL(usb_anchor_empty);
- +
- +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) */
- +
- static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
- {
- struct urb *urb;
- --- a/net/wireless/compat-2.6.28.c
- +++ b/net/wireless/compat-2.6.28.c
- @@ -12,202 +12,8 @@
-
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
-
- -#include <linux/usb.h>
- -
- /* 2.6.28 compat code goes here */
-
- -/*
- - * Compat-wireless notes for USB backport stuff:
- - *
- - * urb->reject exists on 2.6.27, the poison/unpoison helpers
- - * did not though. The anchor poison does not exist so we cannot use them.
- - *
- - * USB anchor poising seems to exist to prevent future driver sumbissions
- - * of usb_anchor_urb() to an anchor marked as poisoned. For older kernels
- - * we cannot use that, so new usb_anchor_urb()s will be anchored. The down
- - * side to this should be submission of URBs will continue being anchored
- - * on an anchor instead of having them being rejected immediately when the
- - * driver realized we needed to stop. For ar9170 we poison URBs upon the
- - * ar9170 mac80211 stop callback(), don't think this should be so bad.
- - * It mean there is period of time in older kernels for which we continue
- - * to anchor new URBs to a known stopped anchor. We have two anchors
- - * (TX, and RX)
- - */
- -
- -#if 0
- -/**
- - * usb_poison_urb - reliably kill a transfer and prevent further use of an URB
- - * @urb: pointer to URB describing a previously submitted request,
- - * may be NULL
- - *
- - * This routine cancels an in-progress request. It is guaranteed that
- - * upon return all completion handlers will have finished and the URB
- - * will be totally idle and cannot be reused. These features make
- - * this an ideal way to stop I/O in a disconnect() callback.
- - * If the request has not already finished or been unlinked
- - * the completion handler will see urb->status == -ENOENT.
- - *
- - * After and while the routine runs, attempts to resubmit the URB will fail
- - * with error -EPERM. Thus even if the URB's completion handler always
- - * tries to resubmit, it will not succeed and the URB will become idle.
- - *
- - * This routine may not be used in an interrupt context (such as a bottom
- - * half or a completion handler), or when holding a spinlock, or in other
- - * situations where the caller can't schedule().
- - *
- - * This routine should not be called by a driver after its disconnect
- - * method has returned.
- - */
- -void usb_poison_urb(struct urb *urb)
- -{
- - might_sleep();
- - if (!(urb && urb->dev && urb->ep))
- - return;
- -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- - spin_lock_irq(&usb_reject_lock);
- -#endif
- - ++urb->reject;
- -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- - spin_unlock_irq(&usb_reject_lock);
- -#endif
- - /*
- - * XXX: usb_hcd_unlink_urb() needs backporting... this is defined
- - * on usb hcd.c but urb.c gets access to it. That is, older kernels
- - * have usb_hcd_unlink_urb() but its not exported, nor can we
- - * re-implement it exactly. This essentially dequeues the urb from
- - * hw, we need to figure out a way to backport this.
- - */
- - //usb_hcd_unlink_urb(urb, -ENOENT);
- -
- - wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
- -}
- -EXPORT_SYMBOL_GPL(usb_poison_urb);
- -#endif
- -
- -void usb_unpoison_urb(struct urb *urb)
- -{
- -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- - unsigned long flags;
- -#endif
- -
- - if (!urb)
- - return;
- -
- -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- - spin_lock_irqsave(&usb_reject_lock, flags);
- -#endif
- - --urb->reject;
- -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
- - spin_unlock_irqrestore(&usb_reject_lock, flags);
- -#endif
- -}
- -EXPORT_SYMBOL_GPL(usb_unpoison_urb);
- -
- -
- -#if 0
- -/**
- - * usb_poison_anchored_urbs - cease all traffic from an anchor
- - * @anchor: anchor the requests are bound to
- - *
- - * this allows all outstanding URBs to be poisoned starting
- - * from the back of the queue. Newly added URBs will also be
- - * poisoned
- - *
- - * This routine should not be called by a driver after its disconnect
- - * method has returned.
- - */
- -void usb_poison_anchored_urbs(struct usb_anchor *anchor)
- -{
- - struct urb *victim;
- -
- - spin_lock_irq(&anchor->lock);
- - // anchor->poisoned = 1; /* XXX: Cannot backport */
- - while (!list_empty(&anchor->urb_list)) {
- - victim = list_entry(anchor->urb_list.prev, struct urb,
- - anchor_list);
- - /* we must make sure the URB isn't freed before we kill it*/
- - usb_get_urb(victim);
- - spin_unlock_irq(&anchor->lock);
- - /* this will unanchor the URB */
- - usb_poison_urb(victim);
- - usb_put_urb(victim);
- - spin_lock_irq(&anchor->lock);
- - }
- - spin_unlock_irq(&anchor->lock);
- -}
- -EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
- -#endif
- -
- -/**
- - * usb_get_from_anchor - get an anchor's oldest urb
- - * @anchor: the anchor whose urb you want
- - *
- - * this will take the oldest urb from an anchor,
- - * unanchor and return it
- - */
- -struct urb *usb_get_from_anchor(struct usb_anchor *anchor)
- -{
- - struct urb *victim;
- - unsigned long flags;
- -
- - spin_lock_irqsave(&anchor->lock, flags);
- - if (!list_empty(&anchor->urb_list)) {
- - victim = list_entry(anchor->urb_list.next, struct urb,
- - anchor_list);
- - usb_get_urb(victim);
- - spin_unlock_irqrestore(&anchor->lock, flags);
- - usb_unanchor_urb(victim);
- - } else {
- - spin_unlock_irqrestore(&anchor->lock, flags);
- - victim = NULL;
- - }
- -
- - return victim;
- -}
- -
- -EXPORT_SYMBOL_GPL(usb_get_from_anchor);
- -
- -/**
- - * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
- - * @anchor: the anchor whose urbs you want to unanchor
- - *
- - * use this to get rid of all an anchor's urbs
- - */
- -void usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
- -{
- - struct urb *victim;
- - unsigned long flags;
- -
- - spin_lock_irqsave(&anchor->lock, flags);
- - while (!list_empty(&anchor->urb_list)) {
- - victim = list_entry(anchor->urb_list.prev, struct urb,
- - anchor_list);
- - usb_get_urb(victim);
- - spin_unlock_irqrestore(&anchor->lock, flags);
- - /* this may free the URB */
- - usb_unanchor_urb(victim);
- - usb_put_urb(victim);
- - spin_lock_irqsave(&anchor->lock, flags);
- - }
- - spin_unlock_irqrestore(&anchor->lock, flags);
- -}
- -
- -EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs);
- -
- -/**
- - * usb_anchor_empty - is an anchor empty
- - * @anchor: the anchor you want to query
- - *
- - * returns 1 if the anchor has no urbs associated with it
- - */
- -int usb_anchor_empty(struct usb_anchor *anchor)
- -{
- - return list_empty(&anchor->urb_list);
- -}
- -
- -EXPORT_SYMBOL_GPL(usb_anchor_empty);
- -
- -
- void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
- {
- /*
- --- a/net/wireless/compat-2.6.29.c
- +++ b/net/wireless/compat-2.6.29.c
- @@ -12,29 +12,7 @@
-
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-
- -#include <linux/usb.h>
- -
- -/**
- - * usb_unpoison_anchored_urbs - let an anchor be used successfully again
- - * @anchor: anchor the requests are bound to
- - *
- - * Reverses the effect of usb_poison_anchored_urbs
- - * the anchor can be used normally after it returns
- - */
- -void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
- -{
- - unsigned long flags;
- - struct urb *lazarus;
- -
- - spin_lock_irqsave(&anchor->lock, flags);
- - list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
- - usb_unpoison_urb(lazarus);
- - }
- - //anchor->poisoned = 0; /* XXX: cannot backport */
- - spin_unlock_irqrestore(&anchor->lock, flags);
- -}
- -EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
- -
- +/* 2.6.29 compat code goes here */
-
- #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
-
- --- a/include/net/compat-2.6.28.h
- +++ b/include/net/compat-2.6.28.h
- @@ -9,7 +9,6 @@
-
- #include <linux/skbuff.h>
- #include <linux/if_ether.h>
- -#include <linux/usb.h>
-
- #ifndef ETH_P_PAE
- #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
- @@ -37,19 +36,6 @@
- #define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
- #endif
-
- -#if 0
- -extern void usb_poison_urb(struct urb *urb);
- -#endif
- -extern void usb_unpoison_urb(struct urb *urb);
- -
- -#if 0
- -extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
- -#endif
- -
- -extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
- -extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
- -extern int usb_anchor_empty(struct usb_anchor *anchor);
- -
-
- void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
-
- --- a/include/net/compat-2.6.29.h
- +++ b/include/net/compat-2.6.29.h
- @@ -8,7 +8,6 @@
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-
- #include <linux/skbuff.h>
- -#include <linux/usb.h>
-
- /**
- * skb_queue_is_first - check if skb is the first entry in the queue
- @@ -41,8 +40,6 @@ static inline struct sk_buff *skb_queue_
- return skb->prev;
- }
-
- -extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
- -
- #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
-
- #endif /* LINUX_26_29_COMPAT_H */
|