1 From 6232c17438ed01f43665197db5a98a4a4f77ef47 Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Thu, 2 Feb 2017 10:57:40 +0100
4 Subject: [PATCH 01/19] rt2x00: avoid introducing a USB dependency in the
9 Though protected by an ifdef, introducing an usb symbol dependency in
10 the rt2x00lib module is a major inconvenience for distributions that
11 package kernel modules split into individual packages.
13 Get rid of this unnecessary dependency by calling the usb related
14 function from a more suitable place.
16 Cc: Vishal Thanki <vishalthanki@gmail.com>
17 Reported-by: Felix Fietkau <nbd@nbd.name>
18 Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
19 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
20 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
22 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 23 ++++++++---------------
23 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 5 +++++
24 2 files changed, 13 insertions(+), 15 deletions(-)
26 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
27 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
28 @@ -1436,21 +1436,6 @@ void rt2x00lib_remove_dev(struct rt2x00_
29 cancel_work_sync(&rt2x00dev->intf_work);
30 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
31 cancel_work_sync(&rt2x00dev->sleep_work);
32 -#if IS_ENABLED(CPTCFG_RT2X00_LIB_USB)
33 - if (rt2x00_is_usb(rt2x00dev)) {
34 - usb_kill_anchored_urbs(rt2x00dev->anchor);
35 - hrtimer_cancel(&rt2x00dev->txstatus_timer);
36 - cancel_work_sync(&rt2x00dev->rxdone_work);
37 - cancel_work_sync(&rt2x00dev->txdone_work);
40 - if (rt2x00dev->workqueue)
41 - destroy_workqueue(rt2x00dev->workqueue);
44 - * Free the tx status fifo.
46 - kfifo_free(&rt2x00dev->txstatus_fifo);
49 * Kill the tx status tasklet.
50 @@ -1466,6 +1451,14 @@ void rt2x00lib_remove_dev(struct rt2x00_
52 rt2x00lib_uninitialize(rt2x00dev);
54 + if (rt2x00dev->workqueue)
55 + destroy_workqueue(rt2x00dev->workqueue);
58 + * Free the tx status fifo.
60 + kfifo_free(&rt2x00dev->txstatus_fifo);
63 * Free extra components
65 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
66 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
67 @@ -744,6 +744,11 @@ void rt2x00usb_uninitialize(struct rt2x0
69 struct data_queue *queue;
71 + usb_kill_anchored_urbs(rt2x00dev->anchor);
72 + hrtimer_cancel(&rt2x00dev->txstatus_timer);
73 + cancel_work_sync(&rt2x00dev->rxdone_work);
74 + cancel_work_sync(&rt2x00dev->txdone_work);
76 queue_for_each(rt2x00dev, queue)
77 rt2x00usb_free_entries(queue);