Skip to content

Commit 98ff26e

Browse files
Stanislaw GruszkaKalle Valo
authored andcommitted
mt76: unify mt76x02_vif struct
Private vif structures definitions are the same for mt76x2 and mt76x0. Signed-off-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 459e237 commit 98ff26e

File tree

13 files changed

+27
-33
lines changed

13 files changed

+27
-33
lines changed

drivers/net/wireless/mediatek/mt76/mt76x0/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ int mt76x0_register_device(struct mt76x0_dev *dev)
689689
hw->max_rate_tries = 1;
690690

691691
hw->sta_data_size = sizeof(struct mt76_sta);
692-
hw->vif_data_size = sizeof(struct mt76_vif);
692+
hw->vif_data_size = sizeof(struct mt76x02_vif);
693693

694694
SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);
695695

drivers/net/wireless/mediatek/mt76/mt76x0/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw,
5656
struct ieee80211_vif *vif)
5757
{
5858
struct mt76x0_dev *dev = hw->priv;
59-
struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
59+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
6060
unsigned int idx;
6161

6262
idx = ffs(~dev->vif_mask);
@@ -77,7 +77,7 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw,
7777
struct ieee80211_vif *vif)
7878
{
7979
struct mt76x0_dev *dev = hw->priv;
80-
struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
80+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
8181
unsigned int wcid = mvif->group_wcid.idx;
8282

8383
dev->wcid_mask[wcid / BITS_PER_LONG] &= ~BIT(wcid % BITS_PER_LONG);
@@ -160,7 +160,7 @@ mt76x0_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
160160
{
161161
struct mt76x0_dev *dev = hw->priv;
162162
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
163-
struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
163+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
164164
int ret = 0;
165165
int idx = 0;
166166

@@ -242,7 +242,7 @@ mt76x0_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
242242
struct ieee80211_key_conf *key)
243243
{
244244
struct mt76x0_dev *dev = hw->priv;
245-
struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
245+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
246246
struct mt76_sta *msta = sta ? (struct mt76_sta *) sta->drv_priv : NULL;
247247
struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid;
248248
int idx = key->keyidx;

drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ struct mt76x0_wcid {
219219
u8 tx_rate_nss;
220220
};
221221

222-
struct mt76_vif {
223-
u8 idx;
224-
225-
struct mt76_wcid group_wcid;
226-
};
227-
228222
struct mt76_tx_status {
229223
u8 valid:1;
230224
u8 success:1;

drivers/net/wireless/mediatek/mt76/mt76x0/tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
167167
msta = (struct mt76_sta *) sta->drv_priv;
168168
wcid = &msta->wcid;
169169
} else if (vif && (!info->control.hw_key && wcid->hw_key_idx != 0xff)) {
170-
struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
170+
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
171171

172172
wcid = &mvif->group_wcid;
173173
}

drivers/net/wireless/mediatek/mt76/mt76x02_mac.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
#ifndef __MT76X02_MAC_H
1919
#define __MT76X02_MAC_H
2020

21+
struct mt76x02_vif {
22+
u8 idx;
23+
24+
struct mt76_wcid group_wcid;
25+
};
26+
2127
static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
2228
{
2329
const u32 MAC_CSR0 = 0x1000;

drivers/net/wireless/mediatek/mt76/mt76x2.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,10 @@ struct mt76x2_dev {
144144
struct mt76x2_dfs_pattern_detector dfs_pd;
145145
};
146146

147-
struct mt76x2_vif {
148-
u8 idx;
149-
150-
struct mt76_wcid group_wcid;
151-
};
152-
153147
struct mt76x2_sta {
154148
struct mt76_wcid wcid; /* must be first */
155149

156-
struct mt76x2_vif *vif;
150+
struct mt76x02_vif *vif;
157151
struct mt76x2_tx_status status;
158152
int n_frames;
159153

drivers/net/wireless/mediatek/mt76/mt76x2_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ void mt76x2_txq_init(struct mt76x2_dev *dev, struct ieee80211_txq *txq)
3232
sta = (struct mt76x2_sta *) txq->sta->drv_priv;
3333
mtxq->wcid = &sta->wcid;
3434
} else {
35-
struct mt76x2_vif *mvif;
35+
struct mt76x02_vif *mvif;
3636

37-
mvif = (struct mt76x2_vif *) txq->vif->drv_priv;
37+
mvif = (struct mt76x02_vif *) txq->vif->drv_priv;
3838
mtxq->wcid = &mvif->group_wcid;
3939
}
4040

@@ -98,7 +98,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
9898
{
9999
struct mt76x2_dev *dev = hw->priv;
100100
struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
101-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
101+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
102102
int ret = 0;
103103
int idx = 0;
104104
int i;
@@ -169,7 +169,7 @@ int mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
169169
struct ieee80211_key_conf *key)
170170
{
171171
struct mt76x2_dev *dev = hw->priv;
172-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
172+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
173173
struct mt76x2_sta *msta;
174174
struct mt76_wcid *wcid;
175175
int idx = key->keyidx;

drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void mt76x2_init_device(struct mt76x2_dev *dev)
209209
hw->extra_tx_headroom = 2;
210210

211211
hw->sta_data_size = sizeof(struct mt76x2_sta);
212-
hw->vif_data_size = sizeof(struct mt76x2_vif);
212+
hw->vif_data_size = sizeof(struct mt76x02_vif);
213213

214214
ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
215215
ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER);

drivers/net/wireless/mediatek/mt76/mt76x2_mac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
struct mt76x2_dev;
2424
struct mt76x2_sta;
25-
struct mt76x2_vif;
25+
struct mt76x02_vif;
2626
struct mt76x2_txwi;
2727

2828
struct mt76x2_tx_status {

drivers/net/wireless/mediatek/mt76/mt76x2_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int
5858
mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
5959
{
6060
struct mt76x2_dev *dev = hw->priv;
61-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
61+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
6262
unsigned int idx = 0;
6363

6464
if (vif->addr[0] & BIT(1))
@@ -167,7 +167,7 @@ mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
167167
struct ieee80211_bss_conf *info, u32 changed)
168168
{
169169
struct mt76x2_dev *dev = hw->priv;
170-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
170+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
171171

172172
mutex_lock(&dev->mt76.mutex);
173173

drivers/net/wireless/mediatek/mt76/mt76x2_tx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void
5858
mt76x2_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
5959
{
6060
struct mt76x2_dev *dev = (struct mt76x2_dev *) priv;
61-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
61+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
6262
struct sk_buff *skb = NULL;
6363

6464
if (!(dev->beacon_mask & BIT(mvif->idx)))
@@ -76,7 +76,7 @@ mt76x2_add_buffered_bc(void *priv, u8 *mac, struct ieee80211_vif *vif)
7676
{
7777
struct beacon_bc_data *data = priv;
7878
struct mt76x2_dev *dev = data->dev;
79-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
79+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
8080
struct ieee80211_tx_info *info;
8181
struct sk_buff *skb;
8282

@@ -164,7 +164,7 @@ void mt76x2_pre_tbtt_tasklet(unsigned long arg)
164164
while ((skb = __skb_dequeue(&data.q)) != NULL) {
165165
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
166166
struct ieee80211_vif *vif = info->control.vif;
167-
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
167+
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
168168

169169
mt76_dma_tx_queue_skb(&dev->mt76, q, skb, &mvif->group_wcid,
170170
NULL);

drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
3737
}
3838

3939
if (vif && !control->sta) {
40-
struct mt76x2_vif *mvif;
40+
struct mt76x02_vif *mvif;
4141

42-
mvif = (struct mt76x2_vif *)vif->drv_priv;
42+
mvif = (struct mt76x02_vif *)vif->drv_priv;
4343
wcid = &mvif->group_wcid;
4444
}
4545

drivers/net/wireless/mediatek/mt76/mt76x2u_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int mt76x2u_add_interface(struct ieee80211_hw *hw,
4949
struct ieee80211_vif *vif)
5050
{
5151
struct mt76x2_dev *dev = hw->priv;
52-
struct mt76x2_vif *mvif = (struct mt76x2_vif *)vif->drv_priv;
52+
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
5353
unsigned int idx = 0;
5454

5555
if (!ether_addr_equal(dev->mt76.macaddr, vif->addr))

0 commit comments

Comments
 (0)