Commit 5ab7d466 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

wifi: mt76: mt792x: move some common usb code in mt792x module



Move the following shared usb routines in mt792x module:
- mt792xu_stop
- mt792x_stop

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 4d2cb56a
Loading
Loading
Loading
Loading
+1 −20
Original line number Diff line number Diff line
@@ -259,25 +259,6 @@ static int mt7921_start(struct ieee80211_hw *hw)
	return err;
}

void mt7921_stop(struct ieee80211_hw *hw)
{
	struct mt792x_dev *dev = mt792x_hw_dev(hw);
	struct mt792x_phy *phy = mt792x_hw_phy(hw);

	cancel_delayed_work_sync(&phy->mt76->mac_work);

	cancel_delayed_work_sync(&dev->pm.ps_work);
	cancel_work_sync(&dev->pm.wake_work);
	cancel_work_sync(&dev->reset_work);
	mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);

	mt792x_mutex_acquire(dev);
	clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
	mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);
	mt792x_mutex_release(dev);
}
EXPORT_SYMBOL_GPL(mt7921_stop);

static int
mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -1312,7 +1293,7 @@ static void mt7921_mgd_complete_tx(struct ieee80211_hw *hw,
const struct ieee80211_ops mt7921_ops = {
	.tx = mt792x_tx,
	.start = mt7921_start,
	.stop = mt7921_stop,
	.stop = mt792x_stop,
	.add_interface = mt7921_add_interface,
	.remove_interface = mt792x_remove_interface,
	.config = mt7921_config,
+0 −1
Original line number Diff line number Diff line
@@ -232,7 +232,6 @@ mt7921_l1_rmw(struct mt792x_dev *dev, u32 addr, u32 mask, u32 val)
#define mt7921_l1_set(dev, addr, val)	mt7921_l1_rmw(dev, addr, 0, val)
#define mt7921_l1_clear(dev, addr, val)	mt7921_l1_rmw(dev, addr, val, 0)

void mt7921_stop(struct ieee80211_hw *hw);
int mt7921_mac_init(struct mt792x_dev *dev);
bool mt7921_mac_wtbl_update(struct mt792x_dev *dev, int idx, u32 mask);
int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+1 −9
Original line number Diff line number Diff line
@@ -135,14 +135,6 @@ static int mt7921u_mac_reset(struct mt792x_dev *dev)
	return err;
}

static void mt7921u_stop(struct ieee80211_hw *hw)
{
	struct mt792x_dev *dev = mt792x_hw_dev(hw);

	mt76u_stop_tx(&dev->mt76);
	mt7921_stop(hw);
}

static int mt7921u_probe(struct usb_interface *usb_intf,
			 const struct usb_device_id *id)
{
@@ -189,7 +181,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
	if (!ops)
		return -ENOMEM;

	ops->stop = mt7921u_stop;
	ops->stop = mt792xu_stop;
	mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), ops, &drv_ops);
	if (!mdev)
		return -ENOMEM;
+1 −19
Original line number Diff line number Diff line
@@ -318,24 +318,6 @@ static int mt7925_start(struct ieee80211_hw *hw)
	return err;
}

void mt7925_stop(struct ieee80211_hw *hw)
{
	struct mt792x_dev *dev = mt792x_hw_dev(hw);
	struct mt792x_phy *phy = mt792x_hw_phy(hw);

	cancel_delayed_work_sync(&phy->mt76->mac_work);

	cancel_delayed_work_sync(&dev->pm.ps_work);
	cancel_work_sync(&dev->pm.wake_work);
	cancel_work_sync(&dev->reset_work);
	mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);

	mt792x_mutex_acquire(dev);
	clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
	mt792x_mutex_release(dev);
}
EXPORT_SYMBOL_GPL(mt7925_stop);

static int
mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
@@ -1411,7 +1393,7 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw,
const struct ieee80211_ops mt7925_ops = {
	.tx = mt792x_tx,
	.start = mt7925_start,
	.stop = mt7925_stop,
	.stop = mt792x_stop,
	.add_interface = mt7925_add_interface,
	.remove_interface = mt792x_remove_interface,
	.config = mt7925_config,
+0 −1
Original line number Diff line number Diff line
@@ -208,7 +208,6 @@ int mt7925_mcu_chip_config(struct mt792x_dev *dev, const char *cmd);
int mt7925_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
			    u8 bit_op, u32 bit_map);

void mt7925_stop(struct ieee80211_hw *hw);
int mt7925_mac_init(struct mt792x_dev *dev);
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
		       struct ieee80211_sta *sta);
Loading