Commit c96b0a39 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'drivers-net-update-tasklet_init-callers'

Emil Renner Berthing says:

====================
drivers: net: update tasklet_init callers

This updates the remaining callers of tasklet_init() in drivers/net
to the new API introduced in
commit 12cc923f ("tasklet: Introduce new initialization API")

All changes are done by coccinelle using the following semantic patch.
Coccinelle needs a little help parsing drivers/net/arcnet/arcnet.c

@ match @
type T;
T *container;
identifier tasklet;
identifier callback;
@@
	tasklet_init(&container->tasklet, callback, (unsigned long)container);

@ patch1 depends on match @
type match.T;
identifier match.tasklet;
identifier match.callback;
identifier data;
identifier container;
@@
-void callback(unsigned long data)
+void callback(struct tasklet_struct *t)
{
	...
-	T *container = (T *)data;
+	T *container = from_tasklet(container, t, tasklet);
	...
}

@ patch2 depends on match @
type match.T;
identifier match.tasklet;
identifier match.callback;
identifier data;
identifier container;
@@
-void callback(unsigned long data)
+void callback(struct tasklet_struct *t)
{
	...
-	T *container;
+	T *container = from_tasklet(container, t, tasklet);
	...
-	container = (T *)data;
	...
}

@ depends on (patch1 || patch2) @
match.T *container;
identifier match.tasklet;
identifier match.callback;
@@
-	tasklet_init(&container->tasklet, callback, (unsigned long)container);
+	tasklet_setup(&container->tasklet, callback);
====================

Link: https://lore.kernel.org/r/20210130234730.26565-1-kernel@esmil.dkSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents d1e1355a 1999ad32
...@@ -427,9 +427,9 @@ static void reset_device_work(struct work_struct *work) ...@@ -427,9 +427,9 @@ static void reset_device_work(struct work_struct *work)
rtnl_unlock(); rtnl_unlock();
} }
static void arcnet_reply_tasklet(unsigned long data) static void arcnet_reply_tasklet(struct tasklet_struct *t)
{ {
struct arcnet_local *lp = (struct arcnet_local *)data; struct arcnet_local *lp = from_tasklet(lp, t, reply_tasklet);
struct sk_buff *ackskb, *skb; struct sk_buff *ackskb, *skb;
struct sock_exterr_skb *serr; struct sock_exterr_skb *serr;
...@@ -530,8 +530,7 @@ int arcnet_open(struct net_device *dev) ...@@ -530,8 +530,7 @@ int arcnet_open(struct net_device *dev)
arc_cont(D_PROTO, "\n"); arc_cont(D_PROTO, "\n");
} }
tasklet_init(&lp->reply_tasklet, arcnet_reply_tasklet, tasklet_setup(&lp->reply_tasklet, arcnet_reply_tasklet);
(unsigned long)lp);
arc_printk(D_INIT, dev, "arcnet_open: resetting card.\n"); arc_printk(D_INIT, dev, "arcnet_open: resetting card.\n");
......
...@@ -598,9 +598,9 @@ static netdev_tx_t cfv_netdev_tx(struct sk_buff *skb, struct net_device *netdev) ...@@ -598,9 +598,9 @@ static netdev_tx_t cfv_netdev_tx(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
static void cfv_tx_release_tasklet(unsigned long drv) static void cfv_tx_release_tasklet(struct tasklet_struct *t)
{ {
struct cfv_info *cfv = (struct cfv_info *)drv; struct cfv_info *cfv = from_tasklet(cfv, t, tx_release_tasklet);
cfv_release_used_buf(cfv->vq_tx); cfv_release_used_buf(cfv->vq_tx);
} }
...@@ -716,9 +716,7 @@ static int cfv_probe(struct virtio_device *vdev) ...@@ -716,9 +716,7 @@ static int cfv_probe(struct virtio_device *vdev)
cfv->ctx.head = USHRT_MAX; cfv->ctx.head = USHRT_MAX;
netif_napi_add(netdev, &cfv->napi, cfv_rx_poll, CFV_DEFAULT_QUOTA); netif_napi_add(netdev, &cfv->napi, cfv_rx_poll, CFV_DEFAULT_QUOTA);
tasklet_init(&cfv->tx_release_tasklet, tasklet_setup(&cfv->tx_release_tasklet, cfv_tx_release_tasklet);
cfv_tx_release_tasklet,
(unsigned long)cfv);
/* Carrier is off until netdevice is opened */ /* Carrier is off until netdevice is opened */
netif_carrier_off(netdev); netif_carrier_off(netdev);
......
...@@ -59,9 +59,9 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev); ...@@ -59,9 +59,9 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev);
static int ifb_open(struct net_device *dev); static int ifb_open(struct net_device *dev);
static int ifb_close(struct net_device *dev); static int ifb_close(struct net_device *dev);
static void ifb_ri_tasklet(unsigned long _txp) static void ifb_ri_tasklet(struct tasklet_struct *t)
{ {
struct ifb_q_private *txp = (struct ifb_q_private *)_txp; struct ifb_q_private *txp = from_tasklet(txp, t, ifb_tasklet);
struct netdev_queue *txq; struct netdev_queue *txq;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -170,8 +170,7 @@ static int ifb_dev_init(struct net_device *dev) ...@@ -170,8 +170,7 @@ static int ifb_dev_init(struct net_device *dev)
__skb_queue_head_init(&txp->tq); __skb_queue_head_init(&txp->tq);
u64_stats_init(&txp->rsync); u64_stats_init(&txp->rsync);
u64_stats_init(&txp->tsync); u64_stats_init(&txp->tsync);
tasklet_init(&txp->ifb_tasklet, ifb_ri_tasklet, tasklet_setup(&txp->ifb_tasklet, ifb_ri_tasklet);
(unsigned long)txp);
netif_tx_start_queue(netdev_get_tx_queue(dev, i)); netif_tx_start_queue(netdev_get_tx_queue(dev, i));
} }
return 0; return 0;
......
...@@ -101,7 +101,7 @@ static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf, ...@@ -101,7 +101,7 @@ static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
char *flags, int count); char *flags, int count);
static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
unsigned long arg); unsigned long arg);
static void ppp_async_process(unsigned long arg); static void ppp_async_process(struct tasklet_struct *t);
static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
int len, int inbound); int len, int inbound);
...@@ -179,7 +179,7 @@ ppp_asynctty_open(struct tty_struct *tty) ...@@ -179,7 +179,7 @@ ppp_asynctty_open(struct tty_struct *tty)
ap->lcp_fcs = -1; ap->lcp_fcs = -1;
skb_queue_head_init(&ap->rqueue); skb_queue_head_init(&ap->rqueue);
tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); tasklet_setup(&ap->tsk, ppp_async_process);
refcount_set(&ap->refcnt, 1); refcount_set(&ap->refcnt, 1);
init_completion(&ap->dead); init_completion(&ap->dead);
...@@ -488,9 +488,9 @@ ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg) ...@@ -488,9 +488,9 @@ ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg)
* to the ppp_generic code, and to tell the ppp_generic code * to the ppp_generic code, and to tell the ppp_generic code
* if we can accept more output now. * if we can accept more output now.
*/ */
static void ppp_async_process(unsigned long arg) static void ppp_async_process(struct tasklet_struct *t)
{ {
struct asyncppp *ap = (struct asyncppp *) arg; struct asyncppp *ap = from_tasklet(ap, t, tsk);
struct sk_buff *skb; struct sk_buff *skb;
/* process received packets */ /* process received packets */
......
...@@ -90,7 +90,7 @@ static struct sk_buff* ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *); ...@@ -90,7 +90,7 @@ static struct sk_buff* ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *);
static int ppp_sync_send(struct ppp_channel *chan, struct sk_buff *skb); static int ppp_sync_send(struct ppp_channel *chan, struct sk_buff *skb);
static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, static int ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd,
unsigned long arg); unsigned long arg);
static void ppp_sync_process(unsigned long arg); static void ppp_sync_process(struct tasklet_struct *t);
static int ppp_sync_push(struct syncppp *ap); static int ppp_sync_push(struct syncppp *ap);
static void ppp_sync_flush_output(struct syncppp *ap); static void ppp_sync_flush_output(struct syncppp *ap);
static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf, static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
...@@ -177,7 +177,7 @@ ppp_sync_open(struct tty_struct *tty) ...@@ -177,7 +177,7 @@ ppp_sync_open(struct tty_struct *tty)
ap->raccm = ~0U; ap->raccm = ~0U;
skb_queue_head_init(&ap->rqueue); skb_queue_head_init(&ap->rqueue);
tasklet_init(&ap->tsk, ppp_sync_process, (unsigned long) ap); tasklet_setup(&ap->tsk, ppp_sync_process);
refcount_set(&ap->refcnt, 1); refcount_set(&ap->refcnt, 1);
init_completion(&ap->dead_cmp); init_completion(&ap->dead_cmp);
...@@ -480,9 +480,9 @@ ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg) ...@@ -480,9 +480,9 @@ ppp_sync_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg)
* to the ppp_generic code, and to tell the ppp_generic code * to the ppp_generic code, and to tell the ppp_generic code
* if we can accept more output now. * if we can accept more output now.
*/ */
static void ppp_sync_process(unsigned long arg) static void ppp_sync_process(struct tasklet_struct *t)
{ {
struct syncppp *ap = (struct syncppp *) arg; struct syncppp *ap = from_tasklet(ap, t, tsk);
struct sk_buff *skb; struct sk_buff *skb;
/* process received packets */ /* process received packets */
......
...@@ -1213,9 +1213,10 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb) ...@@ -1213,9 +1213,10 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
* This needs to be a tasklet otherwise we will * This needs to be a tasklet otherwise we will
* end up recursively calling this function. * end up recursively calling this function.
*/ */
static void hso_unthrottle_tasklet(unsigned long data) static void hso_unthrottle_tasklet(struct tasklet_struct *t)
{ {
struct hso_serial *serial = (struct hso_serial *)data; struct hso_serial *serial = from_tasklet(serial, t,
unthrottle_tasklet);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&serial->serial_lock, flags); spin_lock_irqsave(&serial->serial_lock, flags);
...@@ -1264,9 +1265,8 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) ...@@ -1264,9 +1265,8 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
serial->rx_state = RX_IDLE; serial->rx_state = RX_IDLE;
/* Force default termio settings */ /* Force default termio settings */
_hso_serial_set_termios(tty, NULL); _hso_serial_set_termios(tty, NULL);
tasklet_init(&serial->unthrottle_tasklet, tasklet_setup(&serial->unthrottle_tasklet,
hso_unthrottle_tasklet, hso_unthrottle_tasklet);
(unsigned long)serial);
result = hso_start_serial_device(serial->parent, GFP_KERNEL); result = hso_start_serial_device(serial->parent, GFP_KERNEL);
if (result) { if (result) {
hso_stop_serial_device(serial->parent); hso_stop_serial_device(serial->parent);
......
...@@ -3375,9 +3375,9 @@ static void lan78xx_rx_bh(struct lan78xx_net *dev) ...@@ -3375,9 +3375,9 @@ static void lan78xx_rx_bh(struct lan78xx_net *dev)
netif_wake_queue(dev->net); netif_wake_queue(dev->net);
} }
static void lan78xx_bh(unsigned long param) static void lan78xx_bh(struct tasklet_struct *t)
{ {
struct lan78xx_net *dev = (struct lan78xx_net *)param; struct lan78xx_net *dev = from_tasklet(dev, t, bh);
struct sk_buff *skb; struct sk_buff *skb;
struct skb_data *entry; struct skb_data *entry;
...@@ -3655,7 +3655,7 @@ static int lan78xx_probe(struct usb_interface *intf, ...@@ -3655,7 +3655,7 @@ static int lan78xx_probe(struct usb_interface *intf,
skb_queue_head_init(&dev->txq_pend); skb_queue_head_init(&dev->txq_pend);
mutex_init(&dev->phy_mutex); mutex_init(&dev->phy_mutex);
tasklet_init(&dev->bh, lan78xx_bh, (unsigned long)dev); tasklet_setup(&dev->bh, lan78xx_bh);
INIT_DELAYED_WORK(&dev->wq, lan78xx_delayedwork); INIT_DELAYED_WORK(&dev->wq, lan78xx_delayedwork);
init_usb_anchor(&dev->deferred); init_usb_anchor(&dev->deferred);
......
...@@ -553,12 +553,11 @@ static void read_bulk_callback(struct urb *urb) ...@@ -553,12 +553,11 @@ static void read_bulk_callback(struct urb *urb)
tasklet_schedule(&pegasus->rx_tl); tasklet_schedule(&pegasus->rx_tl);
} }
static void rx_fixup(unsigned long data) static void rx_fixup(struct tasklet_struct *t)
{ {
pegasus_t *pegasus; pegasus_t *pegasus = from_tasklet(pegasus, t, rx_tl);
int status; int status;
pegasus = (pegasus_t *) data;
if (pegasus->flags & PEGASUS_UNPLUG) if (pegasus->flags & PEGASUS_UNPLUG)
return; return;
...@@ -1129,7 +1128,7 @@ static int pegasus_probe(struct usb_interface *intf, ...@@ -1129,7 +1128,7 @@ static int pegasus_probe(struct usb_interface *intf,
goto out1; goto out1;
} }
tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long) pegasus); tasklet_setup(&pegasus->rx_tl, rx_fixup);
INIT_DELAYED_WORK(&pegasus->carrier_check, check_carrier); INIT_DELAYED_WORK(&pegasus->carrier_check, check_carrier);
......
...@@ -2393,11 +2393,9 @@ static void tx_bottom(struct r8152 *tp) ...@@ -2393,11 +2393,9 @@ static void tx_bottom(struct r8152 *tp)
} while (res == 0); } while (res == 0);
} }
static void bottom_half(unsigned long data) static void bottom_half(struct tasklet_struct *t)
{ {
struct r8152 *tp; struct r8152 *tp = from_tasklet(tp, t, tx_tl);
tp = (struct r8152 *)data;
if (test_bit(RTL8152_UNPLUG, &tp->flags)) if (test_bit(RTL8152_UNPLUG, &tp->flags))
return; return;
...@@ -6714,7 +6712,7 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -6714,7 +6712,7 @@ static int rtl8152_probe(struct usb_interface *intf,
mutex_init(&tp->control); mutex_init(&tp->control);
INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t);
INIT_DELAYED_WORK(&tp->hw_phy_work, rtl_hw_phy_work_func_t); INIT_DELAYED_WORK(&tp->hw_phy_work, rtl_hw_phy_work_func_t);
tasklet_init(&tp->tx_tl, bottom_half, (unsigned long)tp); tasklet_setup(&tp->tx_tl, bottom_half);
tasklet_disable(&tp->tx_tl); tasklet_disable(&tp->tx_tl);
netdev->netdev_ops = &rtl8152_netdev_ops; netdev->netdev_ops = &rtl8152_netdev_ops;
......
...@@ -577,9 +577,9 @@ static void free_skb_pool(rtl8150_t *dev) ...@@ -577,9 +577,9 @@ static void free_skb_pool(rtl8150_t *dev)
dev_kfree_skb(dev->rx_skb_pool[i]); dev_kfree_skb(dev->rx_skb_pool[i]);
} }
static void rx_fixup(unsigned long data) static void rx_fixup(struct tasklet_struct *t)
{ {
struct rtl8150 *dev = (struct rtl8150 *)data; struct rtl8150 *dev = from_tasklet(dev, t, tl);
struct sk_buff *skb; struct sk_buff *skb;
int status; int status;
...@@ -878,7 +878,7 @@ static int rtl8150_probe(struct usb_interface *intf, ...@@ -878,7 +878,7 @@ static int rtl8150_probe(struct usb_interface *intf,
return -ENOMEM; return -ENOMEM;
} }
tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev); tasklet_setup(&dev->tl, rx_fixup);
spin_lock_init(&dev->rx_pool_lock); spin_lock_init(&dev->rx_pool_lock);
dev->udev = udev; dev->udev = udev;
......
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