1
0

317-rt2x00-avoid-introducing-a-USB-dependency-in-the-rt2.patch 2.2 KB

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