mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@oracle.com>
To: Kees Cook <keescook@chromium.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: Philippe Reynes <tremyfr@gmail.com>,
	Jarod Wilson <jarod@redhat.com>, Rob Herring <robh@kernel.org>,
	chris hyser <chris.hyser@oracle.com>,
	Tushar Dave <tushar.n.dave@oracle.com>,
	Tobias Klauser <tklauser@distanz.ch>,
	netdev@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 44/58] net: ethernet: sun: Convert timers to use timer_setup()
Date: Tue, 17 Oct 2017 09:27:23 -0700	[thread overview]
Message-ID: <8937e5c4-6b85-6cae-b060-b793eb46bb5b@oracle.com> (raw)
In-Reply-To: <1508200182-104605-45-git-send-email-keescook@chromium.org>

On 10/16/2017 5:29 PM, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Philippe Reynes <tremyfr@gmail.com>
> Cc: Jarod Wilson <jarod@redhat.com>
> Cc: Shannon Nelson <shannon.nelson@oracle.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: chris hyser <chris.hyser@oracle.com>
> Cc: Tushar Dave <tushar.n.dave@oracle.com>
> Cc: Tobias Klauser <tklauser@distanz.ch>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Shannon Nelson <shannon.nelson@oracle.com>

> ---
>   drivers/net/ethernet/sun/cassini.c        |  7 ++++---
>   drivers/net/ethernet/sun/ldmvsw.c         |  3 +--
>   drivers/net/ethernet/sun/niu.c            | 10 ++++------
>   drivers/net/ethernet/sun/sunbmac.c        | 10 ++++------
>   drivers/net/ethernet/sun/sungem.c         |  6 +++---
>   drivers/net/ethernet/sun/sunhme.c         | 10 ++++------
>   drivers/net/ethernet/sun/sunvnet.c        |  3 +--
>   drivers/net/ethernet/sun/sunvnet_common.c |  4 ++--
>   drivers/net/ethernet/sun/sunvnet_common.h |  2 +-
>   9 files changed, 24 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
> index a74d78f64af9..113bd57e2ea0 100644
> --- a/drivers/net/ethernet/sun/cassini.c
> +++ b/drivers/net/ethernet/sun/cassini.c
> @@ -4079,9 +4079,9 @@ static void cas_reset_task(struct work_struct *work)
>   #endif
>   }
>   
> -static void cas_link_timer(unsigned long data)
> +static void cas_link_timer(struct timer_list *t)
>   {
> -	struct cas *cp = (struct cas *) data;
> +	struct cas *cp = from_timer(cp, t, link_timer);
>   	int mask, pending = 0, reset = 0;
>   	unsigned long flags;
>   
> @@ -5039,7 +5039,8 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	spin_lock_init(&cp->stat_lock[N_TX_RINGS]);
>   	mutex_init(&cp->pm_mutex);
>   
> -	setup_timer(&cp->link_timer, cas_link_timer, (unsigned long)cp);
> +	timer_setup(&cp->link_timer, cas_link_timer, 0);
> +
>   #if 1
>   	/* Just in case the implementation of atomic operations
>   	 * change so that an explicit initialization is necessary.
> diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c
> index 5feeaa9f0a9e..5ea037672e6f 100644
> --- a/drivers/net/ethernet/sun/ldmvsw.c
> +++ b/drivers/net/ethernet/sun/ldmvsw.c
> @@ -363,8 +363,7 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
>   	list_add_rcu(&port->list, &vp->port_list);
>   	spin_unlock_irqrestore(&vp->lock, flags);
>   
> -	setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common,
> -		    (unsigned long)port);
> +	timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0);
>   
>   	err = register_netdev(dev);
>   	if (err) {
> diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
> index bde19b307d0d..ab502ee35fb2 100644
> --- a/drivers/net/ethernet/sun/niu.c
> +++ b/drivers/net/ethernet/sun/niu.c
> @@ -2221,9 +2221,9 @@ static int niu_link_status(struct niu *np, int *link_up_p)
>   	return err;
>   }
>   
> -static void niu_timer(unsigned long __opaque)
> +static void niu_timer(struct timer_list *t)
>   {
> -	struct niu *np = (struct niu *) __opaque;
> +	struct niu *np = from_timer(np, t, timer);
>   	unsigned long off;
>   	int err, link_up;
>   
> @@ -6123,7 +6123,7 @@ static int niu_open(struct net_device *dev)
>   
>   	err = niu_init_hw(np);
>   	if (!err) {
> -		setup_timer(&np->timer, niu_timer, (unsigned long)np);
> +		timer_setup(&np->timer, niu_timer, 0);
>   		np->timer.expires = jiffies + HZ;
>   
>   		err = niu_enable_interrupts(np, 1);
> @@ -6773,10 +6773,8 @@ static int niu_change_mtu(struct net_device *dev, int new_mtu)
>   
>   	err = niu_init_hw(np);
>   	if (!err) {
> -		init_timer(&np->timer);
> +		timer_setup(&np->timer, niu_timer, 0);
>   		np->timer.expires = jiffies + HZ;
> -		np->timer.data = (unsigned long) np;
> -		np->timer.function = niu_timer;
>   
>   		err = niu_enable_interrupts(np, 1);
>   		if (err)
> diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
> index 3189722110c2..0b1f41f6bceb 100644
> --- a/drivers/net/ethernet/sun/sunbmac.c
> +++ b/drivers/net/ethernet/sun/sunbmac.c
> @@ -523,9 +523,9 @@ static int try_next_permutation(struct bigmac *bp, void __iomem *tregs)
>   	return -1;
>   }
>   
> -static void bigmac_timer(unsigned long data)
> +static void bigmac_timer(struct timer_list *t)
>   {
> -	struct bigmac *bp = (struct bigmac *) data;
> +	struct bigmac *bp = from_timer(bp, t, bigmac_timer);
>   	void __iomem *tregs = bp->tregs;
>   	int restart_timer = 0;
>   
> @@ -613,8 +613,6 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp)
>   	bp->timer_state = ltrywait;
>   	bp->timer_ticks = 0;
>   	bp->bigmac_timer.expires = jiffies + (12 * HZ) / 10;
> -	bp->bigmac_timer.data = (unsigned long) bp;
> -	bp->bigmac_timer.function = bigmac_timer;
>   	add_timer(&bp->bigmac_timer);
>   }
>   
> @@ -921,7 +919,7 @@ static int bigmac_open(struct net_device *dev)
>   		printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq);
>   		return ret;
>   	}
> -	init_timer(&bp->bigmac_timer);
> +	timer_setup(&bp->bigmac_timer, bigmac_timer, 0);
>   	ret = bigmac_init_hw(bp, 0);
>   	if (ret)
>   		free_irq(dev->irq, bp);
> @@ -1172,7 +1170,7 @@ static int bigmac_ether_init(struct platform_device *op,
>   					      "board-version", 1);
>   
>   	/* Init auto-negotiation timer state. */
> -	init_timer(&bp->bigmac_timer);
> +	timer_setup(&bp->bigmac_timer, bigmac_timer, 0);
>   	bp->timer_state = asleep;
>   	bp->timer_ticks = 0;
>   
> diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
> index b75ab8f44968..a7afcee3c5ae 100644
> --- a/drivers/net/ethernet/sun/sungem.c
> +++ b/drivers/net/ethernet/sun/sungem.c
> @@ -1496,9 +1496,9 @@ static int gem_mdio_link_not_up(struct gem *gp)
>   	}
>   }
>   
> -static void gem_link_timer(unsigned long data)
> +static void gem_link_timer(struct timer_list *t)
>   {
> -	struct gem *gp = (struct gem *) data;
> +	struct gem *gp = from_timer(gp, t, link_timer);
>   	struct net_device *dev = gp->dev;
>   	int restart_aneg = 0;
>   
> @@ -2910,7 +2910,7 @@ static int gem_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   
>   	gp->msg_enable = DEFAULT_MSG;
>   
> -	setup_timer(&gp->link_timer, gem_link_timer, (unsigned long)gp);
> +	timer_setup(&gp->link_timer, gem_link_timer, 0);
>   
>   	INIT_WORK(&gp->reset_task, gem_reset_task);
>   
> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
> index 9e983e1d8249..0431f1e5f511 100644
> --- a/drivers/net/ethernet/sun/sunhme.c
> +++ b/drivers/net/ethernet/sun/sunhme.c
> @@ -685,9 +685,9 @@ static int is_lucent_phy(struct happy_meal *hp)
>   	return ret;
>   }
>   
> -static void happy_meal_timer(unsigned long data)
> +static void happy_meal_timer(struct timer_list *t)
>   {
> -	struct happy_meal *hp = (struct happy_meal *) data;
> +	struct happy_meal *hp = from_timer(hp, t, happy_timer);
>   	void __iomem *tregs = hp->tcvregs;
>   	int restart_timer = 0;
>   
> @@ -1413,8 +1413,6 @@ happy_meal_begin_auto_negotiation(struct happy_meal *hp,
>   
>   	hp->timer_ticks = 0;
>   	hp->happy_timer.expires = jiffies + (12 * HZ)/10;  /* 1.2 sec. */
> -	hp->happy_timer.data = (unsigned long) hp;
> -	hp->happy_timer.function = happy_meal_timer;
>   	add_timer(&hp->happy_timer);
>   }
>   
> @@ -2819,7 +2817,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe)
>   	hp->timer_state = asleep;
>   	hp->timer_ticks = 0;
>   
> -	init_timer(&hp->happy_timer);
> +	timer_setup(&hp->happy_timer, happy_meal_timer, 0);
>   
>   	hp->dev = dev;
>   	dev->netdev_ops = &hme_netdev_ops;
> @@ -3133,7 +3131,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev,
>   	hp->timer_state = asleep;
>   	hp->timer_ticks = 0;
>   
> -	init_timer(&hp->happy_timer);
> +	timer_setup(&hp->happy_timer, happy_meal_timer, 0);
>   
>   	hp->irq = pdev->irq;
>   	hp->dev = dev;
> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index 0b95105f7060..27fb22638885 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
> @@ -492,8 +492,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
>   	pr_info("%s: PORT ( remote-mac %pM%s )\n",
>   		vp->dev->name, port->raddr, switch_port ? " switch-port" : "");
>   
> -	setup_timer(&port->clean_timer, sunvnet_clean_timer_expire_common,
> -		    (unsigned long)port);
> +	timer_setup(&port->clean_timer, sunvnet_clean_timer_expire_common, 0);
>   
>   	napi_enable(&port->napi);
>   	vio_port_up(&port->vio);
> diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c
> index ecf456c7b6d1..8aa3ce46bb81 100644
> --- a/drivers/net/ethernet/sun/sunvnet_common.c
> +++ b/drivers/net/ethernet/sun/sunvnet_common.c
> @@ -1040,9 +1040,9 @@ static inline void vnet_free_skbs(struct sk_buff *skb)
>   	}
>   }
>   
> -void sunvnet_clean_timer_expire_common(unsigned long port0)
> +void sunvnet_clean_timer_expire_common(struct timer_list *t)
>   {
> -	struct vnet_port *port = (struct vnet_port *)port0;
> +	struct vnet_port *port = from_timer(port, t, clean_timer);
>   	struct sk_buff *freeskbs;
>   	unsigned pending;
>   
> diff --git a/drivers/net/ethernet/sun/sunvnet_common.h b/drivers/net/ethernet/sun/sunvnet_common.h
> index b20d6fa7ef25..656673c31066 100644
> --- a/drivers/net/ethernet/sun/sunvnet_common.h
> +++ b/drivers/net/ethernet/sun/sunvnet_common.h
> @@ -129,7 +129,7 @@ struct vnet {
>   	((__port)->vsw ? (__port)->dev : (__port)->vp->dev)
>   
>   /* Common funcs */
> -void sunvnet_clean_timer_expire_common(unsigned long port0);
> +void sunvnet_clean_timer_expire_common(struct timer_list *t);
>   int sunvnet_open_common(struct net_device *dev);
>   int sunvnet_close_common(struct net_device *dev);
>   void sunvnet_set_rx_mode_common(struct net_device *dev, struct vnet *vp);
> 

  reply	other threads:[~2017-10-17 16:28 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  0:28 [PATCH 00/58] networking: " Kees Cook
2017-10-17  0:28 ` [PATCH 01/58] net/decnet: " Kees Cook
2017-10-17  0:28 ` [PATCH 02/58] net/lapb: " Kees Cook
2017-10-17  0:28 ` [PATCH 03/58] net/rose: " Kees Cook
2017-10-17  0:28 ` [PATCH 04/58] net/irda-usb: " Kees Cook
2017-10-17  0:28 ` [PATCH 05/58] net/irda/bfin_sir: " Kees Cook
2017-10-17  0:28 ` [PATCH 06/58] net/ti/tlan: " Kees Cook
2017-10-17  0:28 ` [PATCH 07/58] net/usb/usbnet: " Kees Cook
2017-10-17 10:30   ` Oliver Neukum
2017-10-17  0:28 ` [PATCH 08/58] net/wireless/ray_cs: " Kees Cook
2017-10-27  7:31   ` [08/58] " Kalle Valo
2017-10-17  0:28 ` [PATCH 09/58] net/irda: " Kees Cook
2018-03-02 21:29   ` Marcelo Ricardo Leitner
2018-03-02 22:30     ` Kees Cook
2018-03-02 23:08       ` Marcelo Ricardo Leitner
2017-10-17  0:28 ` [PATCH 10/58] isdn/hisax: " Kees Cook
2017-10-17  0:28 ` [PATCH 11/58] net/hamradio/6pack: " Kees Cook
2017-10-17  0:28 ` [PATCH 12/58] xfrm: " Kees Cook
2017-10-17  0:28 ` [PATCH 13/58] ethernet/broadcom: " Kees Cook
2017-10-17  0:28 ` [PATCH 14/58] net: tulip: de2104x: " Kees Cook
2017-10-17  0:28 ` [PATCH 15/58] pcmcia/electra_cf: " Kees Cook
2017-10-17  0:29 ` [PATCH 16/58] net: ethernet: stmmac: " Kees Cook
2017-10-17  0:29 ` [PATCH 17/58] net/cw1200: " Kees Cook
2017-10-17  0:29 ` [PATCH 18/58] net: vxge: " Kees Cook
2017-10-17  0:29 ` [PATCH 19/58] drivers/atm/suni: " Kees Cook
2017-10-17  0:29 ` [PATCH 20/58] atm: idt77252: " Kees Cook
2017-10-17  0:29 ` [PATCH 21/58] net: tulip: " Kees Cook
2017-10-17  0:29 ` [PATCH 22/58] net: can: " Kees Cook
2017-10-17  0:29 ` [PATCH 23/58] drivers/net/3com: " Kees Cook
2017-10-17  0:29 ` [PATCH 24/58] chelsio: " Kees Cook
2017-10-17  0:29 ` [PATCH 25/58] net: amd8111e: " Kees Cook
2017-10-17  0:29 ` [PATCH 26/58] bna: " Kees Cook
2017-10-17  0:29 ` [PATCH 27/58] net: dl2k: " Kees Cook
2017-10-17  0:29 ` [PATCH 28/58] net: ksz884x: " Kees Cook
2017-10-17  0:29 ` [PATCH 29/58] forcedeth: " Kees Cook
2017-10-17  0:29 ` [PATCH 30/58] mISDN: " Kees Cook
2017-10-17  0:29 ` [PATCH 31/58] isdn/gigaset: Use kzalloc instead of open-coded field zeroing Kees Cook
2017-10-19 20:46   ` Paul Bolle
2017-10-17  0:29 ` [PATCH 32/58] isdn/gigaset: Convert timers to use timer_setup() Kees Cook
2017-10-19 21:03   ` Paul Bolle
2017-10-19 21:20     ` Paul Bolle
2017-10-19 21:31       ` Thomas Gleixner
2017-10-19 21:51         ` Paul Bolle
2017-10-19 22:28           ` Thomas Gleixner
2017-10-19 23:31             ` Paul Bolle
2017-10-19 21:31       ` Kees Cook
2017-10-19 22:16         ` Paul Bolle
2017-10-17  0:29 ` [PATCH 33/58] net: sched: " Kees Cook
2017-10-17  0:29 ` [PATCH 34/58] netfilter: ipset: " Kees Cook
2017-10-17  0:29 ` [PATCH 35/58] inet/connection_sock: " Kees Cook
2017-10-17  0:29 ` [PATCH 36/58] inet: frags: " Kees Cook
2017-10-17  0:29 ` [PATCH 37/58] net/core: Collapse redundant sk_timer callback data assignments Kees Cook
2017-10-17  0:29 ` [PATCH 38/58] hdlc: Convert timers to use timer_setup() Kees Cook
2017-10-17  0:29 ` [PATCH 39/58] appletalk: Remove unneeded synchronization Kees Cook
2017-10-17  0:29 ` [PATCH 40/58] drivers/net/appletalk: Convert timers to use timer_setup() Kees Cook
2017-10-17  0:29 ` [PATCH 41/58] net/atm/mpc: Stop using open-coded timer .data field Kees Cook
2017-10-17  0:29 ` [PATCH 42/58] isdnloop: Convert timers to use timer_setup() Kees Cook
2017-10-17  0:29 ` [PATCH 43/58] net: ethernet: apple: " Kees Cook
2017-10-17  0:29 ` [PATCH 44/58] net: ethernet: sun: " Kees Cook
2017-10-17 16:27   ` Shannon Nelson [this message]
2017-10-17  0:29 ` [PATCH 45/58] net: seeq: " Kees Cook
2017-10-17  0:29 ` [PATCH 46/58] hamradio/scc: " Kees Cook
2017-10-17  0:29 ` [PATCH 47/58] net/ethernet/sgi: " Kees Cook
2017-10-17  0:29 ` [PATCH 48/58] net: usb: " Kees Cook
2017-10-17  0:29 ` [PATCH 49/58] net: neterion: " Kees Cook
2017-10-17  0:29 ` [PATCH 50/58] net: hns: " Kees Cook
2017-10-17  0:29 ` [PATCH 51/58] ethernet/intel: " Kees Cook
2017-10-17  0:29 ` [PATCH 52/58] net/core: Convert sk_timer users " Kees Cook
2017-10-17  0:29 ` [PATCH 53/58] net: atm: Convert timers " Kees Cook
2017-10-17  0:29 ` [PATCH 54/58] net/xen-netback: " Kees Cook
2017-10-20 16:16   ` Wei Liu
2017-10-17  0:29 ` [PATCH 55/58] net: fs_enet: Remove unused timer Kees Cook
2017-10-17  0:29 ` [PATCH 56/58] um: net: Convert timers to use timer_setup() Kees Cook
2017-10-17  0:29 ` [PATCH 57/58] ipv4: timewait: " Kees Cook
2017-10-17  0:29 ` [PATCH 58/58] sunrpc: " Kees Cook
2017-10-17 14:18 ` [PATCH 00/58] networking: " Kalle Valo
2017-10-17 19:47   ` Kees Cook
2017-10-18  5:44     ` Kalle Valo
2017-10-18 19:45       ` Kees Cook
2017-10-18 11:42 ` David Miller
2017-10-18 19:42   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8937e5c4-6b85-6cae-b060-b793eb46bb5b@oracle.com \
    --to=shannon.nelson@oracle.com \
    --cc=chris.hyser@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jarod@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tklauser@distanz.ch \
    --cc=tremyfr@gmail.com \
    --cc=tushar.n.dave@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®