Skip to contentSkip to conversation

staging: line6: replace init_timer by setup_timer

PATCH In review Aya Mahfouz 3 participants 3 messages Feb 18, 2015 – Feb 24, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: line6: replace init_timer by setup_timer

This patch replaces init_timer and 2 step initialization of function and data by setup_timer using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
-ds.function = e1;
...
-ds.data = e2;

---
 drivers/staging/line6/toneport.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/line6/toneport.c +2 -3
index 6943715..f6035ce 100644
@@ -396,10 +396,9 @@ static int toneport_try_init(struct usb_interface *interface,
 
 	toneport_setup(toneport);
 
-	init_timer(&toneport->timer);
+	setup_timer(&toneport->timer, toneport_start_pcm,
+		    (unsigned long)toneport);
 	toneport->timer.expires = jiffies + TONEPORT_PCM_DELAY * HZ;
-	toneport->timer.function = toneport_start_pcm;
-	toneport->timer.data = (unsigned long)toneport;
 	add_timer(&toneport->timer);
 
 	return 0;
Signature · 1 line
1.9.3
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Aya Mahfouz

This patch replaces init_timer and 2 step initialization of function and data by setup_timer using the following coccinelle script:

You could slightly improve the commit message by saying "to make the code more concise". The change has no other impact because setup_timer is an inline function that just does what is already there.

julia

Quoted 44 lines

@@
expression ds, e1, e2;
@@

(quoted diff) +1 -3
-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
-ds.function = e1;
...
-ds.data = e2;
---
 drivers/staging/line6/toneport.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/line6/toneport.c +2 -3
index 6943715..f6035ce 100644
@@ -396,10 +396,9 @@ static int toneport_try_init(struct usb_interface *interface,
 
 	toneport_setup(toneport);
 
-	init_timer(&toneport->timer);
+	setup_timer(&toneport->timer, toneport_start_pcm,
+		    (unsigned long)toneport);
 	toneport->timer.expires = jiffies + TONEPORT_PCM_DELAY * HZ;
-	toneport->timer.function = toneport_start_pcm;
-	toneport->timer.data = (unsigned long)toneport;
 	add_timer(&toneport->timer);
 
 	return 0;
Signature · 8 lines
1.9.3

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150218043030.GA21690%40localhost.localdomain.
For more options, visit https://groups.google.com/d/optout.
maintainer
#2 lore raw
In reply to Aya Mahfouz
Quoted 16 lines · Aya Mahfouz

This patch replaces init_timer and 2 step initialization of function and data by setup_timer using the following coccinelle script:

@@
expression ds, e1, e2;
@@

(quoted diff) +1 -3
-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
-ds.function = e1;
...
-ds.data = e2;
Quoted 4 lines
---
 drivers/staging/line6/toneport.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

This driver is no longer in Linus's tree, so I can't accept any patches against it :(

sorry,

greg k-h