Commit c96b0a39 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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.dk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents d1e1355a 1999ad32
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -427,9 +427,9 @@ static void reset_device_work(struct work_struct *work)
	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 sock_exterr_skb *serr;
@@ -530,8 +530,7 @@ int arcnet_open(struct net_device *dev)
		arc_cont(D_PROTO, "\n");
	}

	tasklet_init(&lp->reply_tasklet, arcnet_reply_tasklet,
		     (unsigned long)lp);
	tasklet_setup(&lp->reply_tasklet, arcnet_reply_tasklet);

	arc_printk(D_INIT, dev, "arcnet_open: resetting card.\n");

+3 −5
Original line number Diff line number Diff line
@@ -598,9 +598,9 @@ static netdev_tx_t cfv_netdev_tx(struct sk_buff *skb, struct net_device *netdev)
	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);
}

@@ -716,9 +716,7 @@ static int cfv_probe(struct virtio_device *vdev)
	cfv->ctx.head = USHRT_MAX;
	netif_napi_add(netdev, &cfv->napi, cfv_rx_poll, CFV_DEFAULT_QUOTA);

	tasklet_init(&cfv->tx_release_tasklet,
		     cfv_tx_release_tasklet,
		     (unsigned long)cfv);
	tasklet_setup(&cfv->tx_release_tasklet, cfv_tx_release_tasklet);

	/* Carrier is off until netdevice is opened */
	netif_carrier_off(netdev);
+3 −4
Original line number Diff line number Diff line
@@ -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_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 sk_buff *skb;

@@ -170,8 +170,7 @@ static int ifb_dev_init(struct net_device *dev)
		__skb_queue_head_init(&txp->tq);
		u64_stats_init(&txp->rsync);
		u64_stats_init(&txp->tsync);
		tasklet_init(&txp->ifb_tasklet, ifb_ri_tasklet,
			     (unsigned long)txp);
		tasklet_setup(&txp->ifb_tasklet, ifb_ri_tasklet);
		netif_tx_start_queue(netdev_get_tx_queue(dev, i));
	}
	return 0;
+4 −4
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
			    char *flags, int count);
static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
			   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,
			   int len, int inbound);
@@ -179,7 +179,7 @@ ppp_asynctty_open(struct tty_struct *tty)
	ap->lcp_fcs = -1;

	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);
	init_completion(&ap->dead);
@@ -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
 * 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;

	/* process received packets */
+4 −4
Original line number Diff line number Diff line
@@ -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_ioctl(struct ppp_channel *chan, unsigned int cmd,
			  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 void ppp_sync_flush_output(struct syncppp *ap);
static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
@@ -177,7 +177,7 @@ ppp_sync_open(struct tty_struct *tty)
	ap->raccm = ~0U;

	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);
	init_completion(&ap->dead_cmp);
@@ -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
 * 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;

	/* process received packets */
Loading