[PATCH wireless-next 1/8] wifi: mm81x: move beacon work and init below the tx op
Lachlan Hodges <[email protected]>
| Newsgroups | org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
Move mm81x_mac_beacon_work() and mm81x_mac_beacon_init() to below mm81x_mac_ops_tx() to prepare for future multicast handling such that we avoid a forward declaration. No functional change. Signed-off-by: Lachlan Hodges <[email protected]> --- drivers/net/wireless/morsemicro/mm81x/mac.c | 84 ++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/net/wireless/morsemicro/mm81x/mac.c b/drivers/net/wireless/morsemicro/mm81x/mac.c index 08ca116a68b4..4d0131246710 100644 --- a/drivers/net/wireless/morsemicro/mm81x/mac.c +++ b/drivers/net/wireless/morsemicro/mm81x/mac.c @@ -445,39 +445,6 @@ static void mm81x_beacon_h_fill_tx_info(struct mm81x *mors, cpu_to_le32(MM81X_TX_CONF_FLAGS_IMMEDIATE_REPORT); } -static void mm81x_mac_beacon_work(struct work_struct *work) -{ - struct mm81x_vif *mors_vif = - from_work(mors_vif, work, u.ap.beacon_work); - struct mm81x *mors = mm81x_vif_to_mors(mors_vif); - struct mm81x_skbq *mq; - struct sk_buff *beacon; - struct ieee80211_vif *vif = mm81x_vif_to_ieee80211_vif(mors_vif); - struct mm81x_skb_tx_info tx_info = { 0 }; - int num_bcn_vifs = atomic_read(&mors->num_bcn_vifs); - - mq = mm81x_hif_get_tx_beacon_queue(mors); - if (!mq) { - dev_err(mors->dev, "no matching beacon Q found"); - return; - } - - if (mm81x_skbq_count(mq) >= num_bcn_vifs) { - dev_err(mors->dev, - "previous beacon not consumed, dropping req [id:%d]", - mors_vif->id); - return; - } - - beacon = ieee80211_beacon_get(mors->hw, vif, false); - if (!beacon) - return; - - mm81x_beacon_h_fill_tx_info(mors, &tx_info, mors_vif, - cfg80211_chandef_s1g_pri_width(&mors->chandef)); - mm81x_skbq_skb_tx(mq, &beacon, &tx_info, MM81X_SKB_CHAN_BEACON); -} - void mm81x_mac_beacon_irq_handle(struct mm81x *mors, u32 status) { int vif_id; @@ -497,15 +464,6 @@ void mm81x_mac_beacon_irq_handle(struct mm81x *mors, u32 status) } } -static void mm81x_mac_beacon_init(struct mm81x_vif *mors_vif) -{ - struct mm81x *mors = mm81x_vif_to_mors(mors_vif); - - INIT_WORK(&mors_vif->u.ap.beacon_work, mm81x_mac_beacon_work); - mm81x_mac_beacon_irq_enable(mors_vif, true); - atomic_inc(&mors->num_bcn_vifs); -} - static struct hw_scan_tlv_hdr mm81x_hw_scan_h_pack_tlv_hdr(u16 tag, u16 len) { struct hw_scan_tlv_hdr hdr = { .tag = cpu_to_le16(tag), @@ -1329,6 +1287,48 @@ static void mm81x_mac_ops_tx(struct ieee80211_hw *hw, MM81X_SKB_CHAN_DATA); } +static void mm81x_mac_beacon_work(struct work_struct *work) +{ + struct mm81x_vif *mors_vif = + from_work(mors_vif, work, u.ap.beacon_work); + struct mm81x *mors = mm81x_vif_to_mors(mors_vif); + struct mm81x_skbq *mq; + struct sk_buff *beacon; + struct ieee80211_vif *vif = mm81x_vif_to_ieee80211_vif(mors_vif); + struct mm81x_skb_tx_info tx_info = { 0 }; + int num_bcn_vifs = atomic_read(&mors->num_bcn_vifs); + + mq = mm81x_hif_get_tx_beacon_queue(mors); + if (!mq) { + dev_err(mors->dev, "no matching beacon Q found"); + return; + } + + if (mm81x_skbq_count(mq) >= num_bcn_vifs) { + dev_err(mors->dev, + "previous beacon not consumed, dropping req [id:%d]", + mors_vif->id); + return; + } + + beacon = ieee80211_beacon_get(mors->hw, vif, false); + if (!beacon) + return; + + mm81x_beacon_h_fill_tx_info(mors, &tx_info, mors_vif, + cfg80211_chandef_s1g_pri_width(&mors->chandef)); + mm81x_skbq_skb_tx(mq, &beacon, &tx_info, MM81X_SKB_CHAN_BEACON); +} + +static void mm81x_mac_beacon_init(struct mm81x_vif *mors_vif) +{ + struct mm81x *mors = mm81x_vif_to_mors(mors_vif); + + INIT_WORK(&mors_vif->u.ap.beacon_work, mm81x_mac_beacon_work); + mm81x_mac_beacon_irq_enable(mors_vif, true); + atomic_inc(&mors->num_bcn_vifs); +} + static void mm81x_mac_ops_stop(struct ieee80211_hw *hw, bool suspend) { struct mm81x *mors = hw->priv; -- 2.43.0