* [PATCH] drivers/net: wan/sbni: Convert timers to use timer_setup()
@ 2017-10-24 8:47 Kees Cook
2017-10-25 4:22 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2017-10-24 8:47 UTC (permalink / raw)
To: David S. Miller; +Cc: David Howells, netdev, linux-kernel
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 Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/net/wan/sbni.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index bde8c0339831..8e8c4c0e1b64 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -71,6 +71,7 @@
struct net_local {
struct timer_list watchdog;
+ struct net_device *watchdog_dev;
spinlock_t lock;
struct sk_buff *rx_buf_p; /* receive buffer ptr */
@@ -128,7 +129,7 @@ static void send_frame( struct net_device * );
static int upload_data( struct net_device *,
unsigned, unsigned, unsigned, u32 );
static void download_data( struct net_device *, u32 * );
-static void sbni_watchdog( unsigned long );
+static void sbni_watchdog(struct timer_list *);
static void interpret_ack( struct net_device *, unsigned );
static int append_frame_to_pkt( struct net_device *, unsigned, u32 );
static void indicate_pkt( struct net_device * );
@@ -1029,11 +1030,10 @@ indicate_pkt( struct net_device *dev )
*/
static void
-sbni_watchdog( unsigned long arg )
+sbni_watchdog(struct timer_list *t)
{
- struct net_device *dev = (struct net_device *) arg;
- struct net_local *nl = netdev_priv(dev);
- struct timer_list *w = &nl->watchdog;
+ struct net_local *nl = from_timer(nl, t, watchdog);
+ struct net_device *dev = nl->watchdog_dev;
unsigned long flags;
unsigned char csr0;
@@ -1060,11 +1060,7 @@ sbni_watchdog( unsigned long arg )
outb( csr0 | RC_CHK, dev->base_addr + CSR0 );
- init_timer( w );
- w->expires = jiffies + SBNI_TIMEOUT;
- w->data = arg;
- w->function = sbni_watchdog;
- add_timer( w );
+ mod_timer(t, jiffies + SBNI_TIMEOUT);
spin_unlock_irqrestore( &nl->lock, flags );
}
@@ -1195,10 +1191,9 @@ sbni_open( struct net_device *dev )
netif_start_queue( dev );
/* set timer watchdog */
- init_timer( w );
+ nl->watchdog_dev = dev;
+ timer_setup(w, sbni_watchdog, 0);
w->expires = jiffies + SBNI_TIMEOUT;
- w->data = (unsigned long) dev;
- w->function = sbni_watchdog;
add_timer( w );
spin_unlock( &nl->lock );
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/net: wan/sbni: Convert timers to use timer_setup()
2017-10-24 8:47 [PATCH] drivers/net: wan/sbni: Convert timers to use timer_setup() Kees Cook
@ 2017-10-25 4:22 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-25 4:22 UTC (permalink / raw)
To: keescook; +Cc: dhowells, netdev, linux-kernel
From: Kees Cook <keescook@chromium.org>
Date: Tue, 24 Oct 2017 01:47:00 -0700
> 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 Howells <dhowells@redhat.com>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-25 4:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24 8:47 [PATCH] drivers/net: wan/sbni: Convert timers to use timer_setup() Kees Cook
2017-10-25 4:22 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).