Skip to content

Commit

Permalink
add accessor function for struct ieee80211_hw from mt76x2_dev
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Felix Fietkau committed Dec 6, 2015
1 parent 4784fc1 commit 00af5f3
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 25 deletions.
2 changes: 2 additions & 0 deletions mt76x2.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ struct mt76x2_reg_pair {
u32 value;
};

#define mt76_hw(dev) (dev)->hw

u32 mt76x2_rr(struct mt76x2_dev *dev, u32 offset);
void mt76x2_wr(struct mt76x2_dev *dev, u32 offset, u32 val);
u32 mt76x2_rmw(struct mt76x2_dev *dev, u32 offset, u32 mask, u32 val);
Expand Down
2 changes: 1 addition & 1 deletion mt76x2_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void mt76x2_init_debugfs(struct mt76x2_dev *dev)
{
struct dentry *dir;

dir = debugfs_create_dir("mt76", dev->hw->wiphy->debugfsdir);
dir = debugfs_create_dir("mt76", mt76_hw(dev)->wiphy->debugfsdir);
if (!dir)
return;

Expand Down
2 changes: 1 addition & 1 deletion mt76x2_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mt76x2_dma_tx_queue_skb(struct mt76x2_dev *dev, struct mt76x2_queue *q,
put_txwi:
mt76x2_put_txwi(dev, t);
free:
ieee80211_free_txskb(dev->hw, skb);
ieee80211_free_txskb(mt76_hw(dev), skb);
return ret;
}

Expand Down
6 changes: 3 additions & 3 deletions mt76x2_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ mt76x2_init_sband_2g(struct mt76x2_dev *dev)
if (!dev->cap.has_2ghz)
return 0;

dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &dev->sband_2g;
mt76_hw(dev)->wiphy->bands[IEEE80211_BAND_2GHZ] = &dev->sband_2g;
return mt76x2_init_sband(dev, &dev->sband_2g,
mt76x2_channels_2ghz,
ARRAY_SIZE(mt76x2_channels_2ghz),
Expand All @@ -749,7 +749,7 @@ mt76x2_init_sband_5g(struct mt76x2_dev *dev)
if (!dev->cap.has_5ghz)
return 0;

dev->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &dev->sband_5g;
mt76_hw(dev)->wiphy->bands[IEEE80211_BAND_5GHZ] = &dev->sband_5g;
return mt76x2_init_sband(dev, &dev->sband_5g,
mt76x2_channels_5ghz,
ARRAY_SIZE(mt76x2_channels_5ghz),
Expand Down Expand Up @@ -782,7 +782,7 @@ static const struct ieee80211_iface_combination if_comb[] = {

int mt76x2_register_device(struct mt76x2_dev *dev)
{
struct ieee80211_hw *hw = dev->hw;
struct ieee80211_hw *hw = mt76_hw(dev);
struct wiphy *wiphy = hw->wiphy;
void *status_fifo;
int fifo_size;
Expand Down
6 changes: 3 additions & 3 deletions mt76x2_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ mt76x2_mac_tx_rate_val(struct mt76x2_dev *dev, const struct ieee80211_tx_rate *r
int band = dev->chandef.chan->band;
u16 val;

r = &dev->hw->wiphy->bands[band]->bitrates[rate->idx];
r = &mt76_hw(dev)->wiphy->bands[band]->bitrates[rate->idx];
if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
val = r->hw_value_short;
else
Expand Down Expand Up @@ -391,7 +391,7 @@ mt76x2_send_tx_status(struct mt76x2_dev *dev, struct mt76x2_tx_status *stat,
*update = 1;
}

ieee80211_tx_status_noskb(dev->hw, sta, &info);
ieee80211_tx_status_noskb(mt76_hw(dev), sta, &info);

out:
rcu_read_unlock();
Expand Down Expand Up @@ -695,7 +695,7 @@ void mt76x2_mac_work(struct work_struct *work)
dev->aggr_stats[idx++] += val >> 16;
}

ieee80211_queue_delayed_work(dev->hw, &dev->mac_work,
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
MT_CALIBRATE_INTERVAL);

}
4 changes: 2 additions & 2 deletions mt76x2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mt76x2_start(struct ieee80211_hw *hw)
if (ret)
goto out;

ieee80211_queue_delayed_work(dev->hw, &dev->mac_work,
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
MT_CALIBRATE_INTERVAL);
napi_enable(&dev->napi);

Expand Down Expand Up @@ -499,6 +499,6 @@ void mt76x2_rx(struct mt76x2_dev *dev, struct sk_buff *skb)
return;
}

ieee80211_rx(dev->hw, skb);
ieee80211_rx(mt76_hw(dev), skb);
}

6 changes: 3 additions & 3 deletions mt76x2_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;

error:
ieee80211_free_hw(dev->hw);
ieee80211_free_hw(mt76_hw(dev));
return ret;
}

Expand All @@ -114,9 +114,9 @@ mt76pci_remove(struct pci_dev *pdev)
{
struct mt76x2_dev *dev = pci_get_drvdata(pdev);

ieee80211_unregister_hw(dev->hw);
ieee80211_unregister_hw(mt76_hw(dev));
mt76x2_cleanup(dev);
ieee80211_free_hw(dev->hw);
ieee80211_free_hw(mt76_hw(dev));
printk("pci device driver detached\n");
}

Expand Down
4 changes: 2 additions & 2 deletions mt76x2_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ int mt76x2_phy_set_channel(struct mt76x2_dev *dev,
mt76x2_phy_channel_calibrate(dev, true);
mt76x2_get_agc_gain(dev, dev->cal.agc_gain_init);

ieee80211_queue_delayed_work(dev->hw, &dev->cal_work,
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
MT_CALIBRATE_INTERVAL);

return 0;
Expand Down Expand Up @@ -702,7 +702,7 @@ void mt76x2_phy_calibrate(struct work_struct *work)
mt76x2_phy_tssi_compensate(dev);
mt76x2_phy_temp_compensate(dev);
mt76x2_phy_update_channel_gain(dev);
ieee80211_queue_delayed_work(dev->hw, &dev->cal_work,
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
MT_CALIBRATE_INTERVAL);
}

Expand Down
2 changes: 1 addition & 1 deletion mt76x2_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#define MAXNAME 32
#define DEV_ENTRY __array(char, wiphy_name, 32)
#define DEV_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(dev->hw->wiphy), MAXNAME)
#define DEV_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(mt76_hw(dev)->wiphy), MAXNAME)
#define DEV_PR_FMT "%s"
#define DEV_PR_ARG __entry->wiphy_name

Expand Down
18 changes: 9 additions & 9 deletions mt76x2_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ void mt76x2_tx_complete(struct mt76x2_dev *dev, struct sk_buff *skb)
int qid = skb_get_queue_mapping(skb);

if (info->flags & IEEE80211_TX_CTL_AMPDU) {
ieee80211_free_txskb(dev->hw, skb);
ieee80211_free_txskb(mt76_hw(dev), skb);
} else {
ieee80211_tx_info_clear_status(info);
info->status.rates[0].idx = -1;
info->flags |= IEEE80211_TX_STAT_ACK;
ieee80211_tx_status(dev->hw, skb);
ieee80211_tx_status(mt76_hw(dev), skb);
}

q = &dev->q_tx[qid];
if (q->queued < q->ndesc - 8)
ieee80211_wake_queue(dev->hw, qid);
ieee80211_wake_queue(mt76_hw(dev), qid);
}

static void
Expand All @@ -87,7 +87,7 @@ mt76x2_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
if (!(dev->beacon_mask & BIT(mvif->idx)))
return;

skb = ieee80211_beacon_get(dev->hw, vif);
skb = ieee80211_beacon_get(mt76_hw(dev), vif);
if (!skb)
return;

Expand Down Expand Up @@ -119,7 +119,7 @@ mt76x2_add_buffered_bc(void *priv, u8 *mac, struct ieee80211_vif *vif)
if (!(dev->beacon_mask & BIT(mvif->idx)))
return;

skb = ieee80211_get_buffered_bc(dev->hw, vif);
skb = ieee80211_get_buffered_bc(mt76_hw(dev), vif);
if (!skb)
return;

Expand All @@ -142,13 +142,13 @@ void mt76x2_pre_tbtt_tasklet(unsigned long arg)
data.dev = dev;
__skb_queue_head_init(&data.q);

ieee80211_iterate_active_interfaces_atomic(dev->hw,
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
IEEE80211_IFACE_ITER_RESUME_ALL,
mt76x2_update_beacon_iter, dev);

do {
nframes = skb_queue_len(&data.q);
ieee80211_iterate_active_interfaces_atomic(dev->hw,
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
IEEE80211_IFACE_ITER_RESUME_ALL,
mt76x2_add_buffered_bc, &data);
} while (nframes != skb_queue_len(&data.q));
Expand Down Expand Up @@ -199,7 +199,7 @@ mt76x2_txq_dequeue(struct mt76x2_dev *dev, struct mt76x2_txq *mtxq, bool ps)
return skb;
}

skb = ieee80211_tx_dequeue(dev->hw, txq);
skb = ieee80211_tx_dequeue(mt76_hw(dev), txq);
if (!skb)
return NULL;

Expand Down Expand Up @@ -484,5 +484,5 @@ void mt76x2_txq_remove(struct mt76x2_dev *dev, struct ieee80211_txq *txq)
spin_unlock_bh(&hwq->lock);

while ((skb = skb_dequeue(&mtxq->retry_q)) != NULL)
ieee80211_free_txskb(dev->hw, skb);
ieee80211_free_txskb(mt76_hw(dev), skb);
}

0 comments on commit 00af5f3

Please sign in to comment.