1
0

020-01-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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
  5. rt2x00lib module
  6. As reported by Felix:
  7. Though protected by an ifdef, introducing an usb symbol dependency in
  8. the rt2x00lib module is a major inconvenience for distributions that
  9. package kernel modules split into individual packages.
  10. Get rid of this unnecessary dependency by calling the usb related
  11. function from a more suitable place.
  12. Cc: Vishal Thanki <vishalthanki@gmail.com>
  13. Reported-by: Felix Fietkau <nbd@nbd.name>
  14. Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
  15. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
  16. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17. ---
  18. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 23 ++++++++---------------
  19. drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 5 +++++
  20. 2 files changed, 13 insertions(+), 15 deletions(-)
  21. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  22. index 8fcbc8dc94c1..4b08007f93f7 100644
  23. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  24. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  25. @@ -1436,21 +1436,6 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
  26. cancel_work_sync(&rt2x00dev->intf_work);
  27. cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  28. cancel_work_sync(&rt2x00dev->sleep_work);
  29. -#if IS_ENABLED(CPTCFG_RT2X00_LIB_USB)
  30. - if (rt2x00_is_usb(rt2x00dev)) {
  31. - usb_kill_anchored_urbs(rt2x00dev->anchor);
  32. - hrtimer_cancel(&rt2x00dev->txstatus_timer);
  33. - cancel_work_sync(&rt2x00dev->rxdone_work);
  34. - cancel_work_sync(&rt2x00dev->txdone_work);
  35. - }
  36. -#endif
  37. - if (rt2x00dev->workqueue)
  38. - destroy_workqueue(rt2x00dev->workqueue);
  39. -
  40. - /*
  41. - * Free the tx status fifo.
  42. - */
  43. - kfifo_free(&rt2x00dev->txstatus_fifo);
  44. /*
  45. * Kill the tx status tasklet.
  46. @@ -1466,6 +1451,14 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
  47. */
  48. rt2x00lib_uninitialize(rt2x00dev);
  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. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
  61. index 838ca58d2dd6..5a2bf9f63cd7 100644
  62. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
  63. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
  64. @@ -744,6 +744,11 @@ void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev)
  65. {
  66. struct data_queue *queue;
  67. + usb_kill_anchored_urbs(rt2x00dev->anchor);
  68. + hrtimer_cancel(&rt2x00dev->txstatus_timer);
  69. + cancel_work_sync(&rt2x00dev->rxdone_work);
  70. + cancel_work_sync(&rt2x00dev->txdone_work);
  71. +
  72. queue_for_each(rt2x00dev, queue)
  73. rt2x00usb_free_entries(queue);
  74. }
  75. --
  76. 2.12.1