diff mbox series

[6/6] mt76x2u: introduce mac workqueue support

Message ID 69563ff705ac496ed505a0111129c7ed7015f2bc.1539595605.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show
Series unify debugfs code between mt76x0 and mt76x2 | expand

Commit Message

Lorenzo Bianconi Oct. 15, 2018, 9:33 a.m. UTC
Add mac workqueue support to mt76x2u driver in order
to compute device statistics and add mac stuck routine

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x2/init.c     | 2 ++
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c | 1 -
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c | 1 +
 drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c | 2 ++
 4 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
index 3c73fdeaf30f..04790f84d7d4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/init.c
@@ -162,6 +162,8 @@  void mt76x2_init_device(struct mt76x02_dev *dev)
 {
 	struct ieee80211_hw *hw = mt76_hw(dev);
 
+	INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
+
 	hw->queues = 4;
 	hw->max_rates = 1;
 	hw->max_report_rates = 7;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 5b167aaaf7f7..b15c97e1dfb3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -467,7 +467,6 @@  int mt76x2_register_device(struct mt76x02_dev *dev)
 	int i, ret;
 
 	INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate);
-	INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work);
 
 	mt76x2_init_device(dev);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index dfc80ecfde92..b2388f506505 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -297,6 +297,7 @@  void mt76x2u_stop_hw(struct mt76x02_dev *dev)
 {
 	mt76u_stop_stat_wk(&dev->mt76);
 	cancel_delayed_work_sync(&dev->cal_work);
+	cancel_delayed_work_sync(&dev->mac_work);
 	mt76x2u_mac_stop(dev);
 }
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 1971a1b00038..25c43175e6e5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -27,6 +27,8 @@  static int mt76x2u_start(struct ieee80211_hw *hw)
 	if (ret)
 		goto out;
 
+	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+				     MT_CALIBRATE_INTERVAL);
 	set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
 
 out: