Commit e5443256 authored by Felix Fietkau's avatar Felix Fietkau

mt76: move initialization of some struct members to mt76_alloc_device

Reduces duplication and prepares for further rework
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent aa7619a3
...@@ -555,7 +555,6 @@ mt76_dma_init(struct mt76_dev *dev) ...@@ -555,7 +555,6 @@ mt76_dma_init(struct mt76_dev *dev)
netif_napi_add(&dev->napi_dev, &dev->napi[i], mt76_dma_rx_poll, netif_napi_add(&dev->napi_dev, &dev->napi[i], mt76_dma_rx_poll,
64); 64);
mt76_dma_rx_fill(dev, &dev->q_rx[i]); mt76_dma_rx_fill(dev, &dev->q_rx[i]);
skb_queue_head_init(&dev->rx_skb[i]);
napi_enable(&dev->napi[i]); napi_enable(&dev->napi[i]);
} }
......
...@@ -275,6 +275,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size, ...@@ -275,6 +275,7 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
{ {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct mt76_dev *dev; struct mt76_dev *dev;
int i;
hw = ieee80211_alloc_hw(size, ops); hw = ieee80211_alloc_hw(size, ops);
if (!hw) if (!hw)
...@@ -292,6 +293,11 @@ mt76_alloc_device(struct device *pdev, unsigned int size, ...@@ -292,6 +293,11 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
init_waitqueue_head(&dev->tx_wait); init_waitqueue_head(&dev->tx_wait);
skb_queue_head_init(&dev->status_list); skb_queue_head_init(&dev->status_list);
INIT_LIST_HEAD(&dev->txwi_cache);
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
skb_queue_head_init(&dev->rx_skb[i]);
tasklet_init(&dev->tx_tasklet, mt76_tx_tasklet, (unsigned long)dev); tasklet_init(&dev->tx_tasklet, mt76_tx_tasklet, (unsigned long)dev);
return dev; return dev;
...@@ -307,8 +313,6 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, ...@@ -307,8 +313,6 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
dev_set_drvdata(dev->dev, dev); dev_set_drvdata(dev->dev, dev);
INIT_LIST_HEAD(&dev->txwi_cache);
SET_IEEE80211_DEV(hw, dev->dev); SET_IEEE80211_DEV(hw, dev->dev);
SET_IEEE80211_PERM_ADDR(hw, dev->macaddr); SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);
......
...@@ -956,7 +956,6 @@ int mt76u_init(struct mt76_dev *dev, ...@@ -956,7 +956,6 @@ int mt76u_init(struct mt76_dev *dev,
tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev); tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev);
tasklet_init(&dev->tx_tasklet, mt76u_tx_tasklet, (unsigned long)dev); tasklet_init(&dev->tx_tasklet, mt76u_tx_tasklet, (unsigned long)dev);
INIT_WORK(&usb->stat_work, mt76u_tx_status_data); INIT_WORK(&usb->stat_work, mt76u_tx_status_data);
skb_queue_head_init(&dev->rx_skb[MT_RXQ_MAIN]);
usb->stat_wq = alloc_workqueue("mt76u", WQ_UNBOUND, 0); usb->stat_wq = alloc_workqueue("mt76u", WQ_UNBOUND, 0);
if (!usb->stat_wq) if (!usb->stat_wq)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment