mt76: mt76x02: introduce mt76x02_pre_tbtt_enable and mt76x02_beacon_enable macros
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 1 Aug 2019 08:26:22 +0000 (10:26 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 5 Sep 2019 15:42:31 +0000 (17:42 +0200)
Improve code readability introducing mt76x02_pre_tbtt_enable and
mt76x02_beacon_enable utility macros

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
drivers/net/wireless/mediatek/mt76/mt76x02.h
drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c

index d7bf7bc15e52fac6243212cb3b634a9ddd047384..3bc665643e51cd6176a4de3680f685190ca77f81 100644 (file)
@@ -14,7 +14,7 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
        int ret;
 
        cancel_delayed_work_sync(&dev->cal_work);
-       dev->beacon_ops->pre_tbtt_enable(dev, false);
+       mt76x02_pre_tbtt_enable(dev, false);
        if (mt76_is_mmio(dev))
                tasklet_disable(&dev->dfs_pd.dfs_tasklet);
 
@@ -31,7 +31,7 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
                mt76x02_dfs_init_params(dev);
                tasklet_enable(&dev->dfs_pd.dfs_tasklet);
        }
-       dev->beacon_ops->pre_tbtt_enable(dev, true);
+       mt76x02_pre_tbtt_enable(dev, true);
 
        mt76_txq_schedule_all(&dev->mt76);
 
index 35cf92a0d77582c35ec31af70e94287d9610edf5..56a6110f5bbbb9ecf292bd33b92847c89254ba3c 100644 (file)
@@ -64,6 +64,11 @@ struct mt76x02_beacon_ops {
        void (*beacon_enable)(struct mt76x02_dev *dev, bool en);
 };
 
+#define mt76x02_beacon_enable(dev, enable)     \
+       (dev)->beacon_ops->beacon_enable(dev, enable)
+#define mt76x02_pre_tbtt_enable(dev, enable)   \
+       (dev)->beacon_ops->pre_tbtt_enable(dev, enable)
+
 struct mt76x02_dev {
        struct mt76_dev mt76; /* must be first */
 
index 12ee1e796cb813c64978fb6a1799fab9c57c3352..808f134c251e9fd814a174c239c4f2b1c5b07406 100644 (file)
@@ -130,8 +130,7 @@ __mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx,
              MT_BEACON_TIME_CFG_TBTT_EN |
              MT_BEACON_TIME_CFG_TIMER_EN;
        mt76_rmw(dev, MT_BEACON_TIME_CFG, reg, reg * en);
-
-       dev->beacon_ops->beacon_enable(dev, en);
+       mt76x02_beacon_enable(dev, en);
 }
 
 void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
@@ -140,7 +139,7 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
        u8 vif_idx = ((struct mt76x02_vif *)vif->drv_priv)->idx;
        struct sk_buff *skb = NULL;
 
-       dev->beacon_ops->pre_tbtt_enable(dev, false);
+       mt76x02_pre_tbtt_enable(dev, false);
 
        if (mt76_is_usb(dev))
                skb = ieee80211_beacon_get(mt76_hw(dev), vif);
@@ -150,7 +149,7 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
 
        __mt76x02_mac_set_beacon_enable(dev, vif_idx, val, skb);
 
-       dev->beacon_ops->pre_tbtt_enable(dev, true);
+       mt76x02_pre_tbtt_enable(dev, true);
 }
 
 void
index 6b4c94101fb8bafc18e967250b3a597f623d36c5..6a36b67510e3203cbb70edce1bfff56ba0d94964 100644 (file)
@@ -37,7 +37,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
        int err;
 
        cancel_delayed_work_sync(&dev->cal_work);
-       dev->beacon_ops->pre_tbtt_enable(dev, false);
+       mt76x02_pre_tbtt_enable(dev, false);
 
        mutex_lock(&dev->mt76.mutex);
        set_bit(MT76_RESET, &dev->mt76.state);
@@ -53,7 +53,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
        clear_bit(MT76_RESET, &dev->mt76.state);
        mutex_unlock(&dev->mt76.mutex);
 
-       dev->beacon_ops->pre_tbtt_enable(dev, true);
+       mt76x02_pre_tbtt_enable(dev, true);
        mt76_txq_schedule_all(&dev->mt76);
 
        return err;