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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 6232c17438ed01f43665197db5a98a4a4f77ef47 Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <[email protected]>
  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 <[email protected]>
  13. Reported-by: Felix Fietkau <[email protected]>
  14. Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
  15. Signed-off-by: Stanislaw Gruszka <[email protected]>
  16. Signed-off-by: Kalle Valo <[email protected]>
  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. --- 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. * Kill the tx status tasklet.
  44. @@ -1466,6 +1451,14 @@ void rt2x00lib_remove_dev(struct rt2x00_
  45. */
  46. rt2x00lib_uninitialize(rt2x00dev);
  47. + if (rt2x00dev->workqueue)
  48. + destroy_workqueue(rt2x00dev->workqueue);
  49. +
  50. + /*
  51. + * Free the tx status fifo.
  52. + */
  53. + kfifo_free(&rt2x00dev->txstatus_fifo);
  54. +
  55. /*
  56. * Free extra components
  57. */
  58. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
  59. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
  60. @@ -744,6 +744,11 @@ void rt2x00usb_uninitialize(struct rt2x0
  61. {
  62. struct data_queue *queue;
  63. + usb_kill_anchored_urbs(rt2x00dev->anchor);
  64. + hrtimer_cancel(&rt2x00dev->txstatus_timer);
  65. + cancel_work_sync(&rt2x00dev->rxdone_work);
  66. + cancel_work_sync(&rt2x00dev->txdone_work);
  67. +
  68. queue_for_each(rt2x00dev, queue)
  69. rt2x00usb_free_entries(queue);
  70. }