Skip to content

Commit

Permalink
net: micrel: convert tasklets to use new tasklet_setup() API
Browse files Browse the repository at this point in the history
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Allen Pais authored and David S. Miller committed Sep 14, 2020
1 parent a1be161 commit 9ad5a25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
17 changes: 8 additions & 9 deletions drivers/net/ethernet/micrel/ks8842.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev)
return err;
}

static void ks8842_rx_frame_dma_tasklet(unsigned long arg)
static void ks8842_rx_frame_dma_tasklet(struct tasklet_struct *t)
{
struct net_device *netdev = (struct net_device *)arg;
struct ks8842_adapter *adapter = netdev_priv(netdev);
struct ks8842_adapter *adapter = from_tasklet(adapter, t, dma_rx.tasklet);
struct net_device *netdev = adapter->netdev;
struct ks8842_rx_dma_ctl *ctl = &adapter->dma_rx;
struct sk_buff *skb = ctl->skb;
dma_addr_t addr = sg_dma_address(&ctl->sg);
Expand Down Expand Up @@ -720,10 +720,10 @@ static void ks8842_handle_rx_overrun(struct net_device *netdev,
netdev->stats.rx_fifo_errors++;
}

static void ks8842_tasklet(unsigned long arg)
static void ks8842_tasklet(struct tasklet_struct *t)
{
struct net_device *netdev = (struct net_device *)arg;
struct ks8842_adapter *adapter = netdev_priv(netdev);
struct ks8842_adapter *adapter = from_tasklet(adapter, t, tasklet);
struct net_device *netdev = adapter->netdev;
u16 isr;
unsigned long flags;
u16 entry_bank;
Expand Down Expand Up @@ -953,8 +953,7 @@ static int ks8842_alloc_dma_bufs(struct net_device *netdev)
goto err;
}

tasklet_init(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet,
(unsigned long)netdev);
tasklet_setup(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet);

return 0;
err:
Expand Down Expand Up @@ -1173,7 +1172,7 @@ static int ks8842_probe(struct platform_device *pdev)
adapter->dma_tx.channel = -1;
}

tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev);
tasklet_setup(&adapter->tasklet, ks8842_tasklet);
spin_lock_init(&adapter->lock);

netdev->netdev_ops = &ks8842_netdev_ops;
Expand Down
14 changes: 6 additions & 8 deletions drivers/net/ethernet/micrel/ksz884x.c
Original file line number Diff line number Diff line change
Expand Up @@ -5159,9 +5159,9 @@ static int dev_rcv_special(struct dev_info *hw_priv)
return received;
}

static void rx_proc_task(unsigned long data)
static void rx_proc_task(struct tasklet_struct *t)
{
struct dev_info *hw_priv = (struct dev_info *) data;
struct dev_info *hw_priv = from_tasklet(hw_priv, t, rx_tasklet);
struct ksz_hw *hw = &hw_priv->hw;

if (!hw->enabled)
Expand All @@ -5181,9 +5181,9 @@ static void rx_proc_task(unsigned long data)
}
}

static void tx_proc_task(unsigned long data)
static void tx_proc_task(struct tasklet_struct *t)
{
struct dev_info *hw_priv = (struct dev_info *) data;
struct dev_info *hw_priv = from_tasklet(hw_priv, t, tx_tasklet);
struct ksz_hw *hw = &hw_priv->hw;

hw_ack_intr(hw, KS884X_INT_TX_MASK);
Expand Down Expand Up @@ -5436,10 +5436,8 @@ static int prepare_hardware(struct net_device *dev)
rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
if (rc)
return rc;
tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,
(unsigned long) hw_priv);
tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,
(unsigned long) hw_priv);
tasklet_setup(&hw_priv->rx_tasklet, rx_proc_task);
tasklet_setup(&hw_priv->tx_tasklet, tx_proc_task);

hw->promiscuous = 0;
hw->all_multi = 0;
Expand Down

0 comments on commit 9ad5a25

Please sign in to comment.