diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-05-20 08:43:47 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-05-23 10:58:13 +0300 |
commit | a85b590cf55f0789efcdd347b69c9e8ad6c3dcc7 (patch) | |
tree | 27014c072b21202b71db085b35a59ad7c1f5a321 /drivers/net/wireless/mediatek/mt76/mac80211.c | |
parent | a164a94212ceb606d40e92db7a58e9dbcb3ff74e (diff) | |
download | linux-a85b590cf55f0789efcdd347b69c9e8ad6c3dcc7.tar.xz |
mt76: move ieee80211_hw allocation to common core
Allows it to be shared between different drivers and locks to be
initialized earlier
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mac80211.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mac80211.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index d862e5efd094..d1044e5b25db 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -268,6 +268,26 @@ mt76_check_sband(struct mt76_dev *dev, int band) dev->hw->wiphy->bands[band] = NULL; } +struct mt76_dev * +mt76_alloc_device(unsigned int size, const struct ieee80211_ops *ops) +{ + struct ieee80211_hw *hw; + struct mt76_dev *dev; + + hw = ieee80211_alloc_hw(size, ops); + if (!hw) + return NULL; + + dev = hw->priv; + dev->hw = hw; + spin_lock_init(&dev->rx_lock); + spin_lock_init(&dev->lock); + spin_lock_init(&dev->cc_lock); + + return dev; +} +EXPORT_SYMBOL_GPL(mt76_alloc_device); + int mt76_register_device(struct mt76_dev *dev, bool vht, struct ieee80211_rate *rates, int n_rates) { @@ -277,8 +297,6 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, dev_set_drvdata(dev->dev, dev); - spin_lock_init(&dev->lock); - spin_lock_init(&dev->cc_lock); INIT_LIST_HEAD(&dev->txwi_cache); SET_IEEE80211_DEV(hw, dev->dev); |