c0274ddde97a98b90e7d4a35c2b8872fff060239
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 317-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch
1 From: Stanislaw Gruszka <sgruszka@redhat.com>
2 Date: Thu, 2 Feb 2017 10:57:40 +0100
3 Subject: [PATCH] rt2x00: avoid introducing a USB dependency in the
4 rt2x00lib module
5
6 As reported by Felix:
7
8 Though protected by an ifdef, introducing an usb symbol dependency in
9 the rt2x00lib module is a major inconvenience for distributions that
10 package kernel modules split into individual packages.
11
12 Get rid of this unnecessary dependency by calling the usb related
13 function from a more suitable place.
14
15 Cc: Vishal Thanki <vishalthanki@gmail.com>
16 Reported-by: Felix Fietkau <nbd@nbd.name>
17 Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
18 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
19 ---
20
21 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
22 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
23 @@ -1436,21 +1436,6 @@ void rt2x00lib_remove_dev(struct rt2x00_
24 cancel_work_sync(&rt2x00dev->intf_work);
25 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
26 cancel_work_sync(&rt2x00dev->sleep_work);
27 -#if IS_ENABLED(CPTCFG_RT2X00_LIB_USB)
28 - if (rt2x00_is_usb(rt2x00dev)) {
29 - usb_kill_anchored_urbs(rt2x00dev->anchor);
30 - hrtimer_cancel(&rt2x00dev->txstatus_timer);
31 - cancel_work_sync(&rt2x00dev->rxdone_work);
32 - cancel_work_sync(&rt2x00dev->txdone_work);
33 - }
34 -#endif
35 - if (rt2x00dev->workqueue)
36 - destroy_workqueue(rt2x00dev->workqueue);
37 -
38 - /*
39 - * Free the tx status fifo.
40 - */
41 - kfifo_free(&rt2x00dev->txstatus_fifo);
42
43 /*
44 * Kill the tx status tasklet.
45 @@ -1466,6 +1451,14 @@ void rt2x00lib_remove_dev(struct rt2x00_
46 */
47 rt2x00lib_uninitialize(rt2x00dev);
48
49 + if (rt2x00dev->workqueue)
50 + destroy_workqueue(rt2x00dev->workqueue);
51 +
52 + /*
53 + * Free the tx status fifo.
54 + */
55 + kfifo_free(&rt2x00dev->txstatus_fifo);
56 +
57 /*
58 * Free extra components
59 */
60 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
61 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
62 @@ -744,6 +744,11 @@ void rt2x00usb_uninitialize(struct rt2x0
63 {
64 struct data_queue *queue;
65
66 + usb_kill_anchored_urbs(rt2x00dev->anchor);
67 + hrtimer_cancel(&rt2x00dev->txstatus_timer);
68 + cancel_work_sync(&rt2x00dev->rxdone_work);
69 + cancel_work_sync(&rt2x00dev->txdone_work);
70 +
71 queue_for_each(rt2x00dev, queue)
72 rt2x00usb_free_entries(queue);
73 }