All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: comedi: drivers: replace init_timer by setup_timer
@ 2015-02-19  0:07 Aya Mahfouz
  2015-02-19  6:56 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Aya Mahfouz @ 2015-02-19  0:07 UTC (permalink / raw)
  To: outreachy-kernel

This patch replaces init_timer and 2 step initialization of function and
data by setup_timer to make the code  more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

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


Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
 drivers/staging/comedi/drivers/comedi_test.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index e56525a..fbc4342 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -420,9 +420,8 @@ static int waveform_attach(struct comedi_device *dev,
 	for (i = 0; i < s->n_chan; i++)
 		devpriv->ao_loopbacks[i] = s->maxdata / 2;
 
-	init_timer(&devpriv->timer);
-	devpriv->timer.function = waveform_ai_interrupt;
-	devpriv->timer.data = (unsigned long)dev;
+	setup_timer(&devpriv->timer, waveform_ai_interrupt,
+		    (unsigned long)dev);
 
 	dev_info(dev->class_dev,
 		 "%s: %i microvolt, %li microsecond waveform attached\n",
-- 
1.9.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH v3] staging: comedi: drivers: replace init_timer by setup_timer
  2015-02-19  0:07 [PATCH v3] staging: comedi: drivers: replace init_timer by setup_timer Aya Mahfouz
@ 2015-02-19  6:56 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2015-02-19  6:56 UTC (permalink / raw)
  To: Aya Mahfouz; +Cc: outreachy-kernel

You need to say, eiter in a cover letter or in the patch below the ---, 
what the difference as compared to v2 is.

julia

On Thu, 19 Feb 2015, Aya Mahfouz wrote:

> This patch replaces init_timer and 2 step initialization of function and
> data by setup_timer to make the code  more concise.
> 
> The issue was discovered using the following coccinelle script:
> 
> @@
> expression ds, e1, e2;
> @@
> 
> -init_timer (&ds);
> +setup_timer (&ds, e1, e2);
> ...
> -ds.function = e1;
> ...
> -ds.data = e2;
> 
> 
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
>  drivers/staging/comedi/drivers/comedi_test.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
> index e56525a..fbc4342 100644
> --- a/drivers/staging/comedi/drivers/comedi_test.c
> +++ b/drivers/staging/comedi/drivers/comedi_test.c
> @@ -420,9 +420,8 @@ static int waveform_attach(struct comedi_device *dev,
>  	for (i = 0; i < s->n_chan; i++)
>  		devpriv->ao_loopbacks[i] = s->maxdata / 2;
>  
> -	init_timer(&devpriv->timer);
> -	devpriv->timer.function = waveform_ai_interrupt;
> -	devpriv->timer.data = (unsigned long)dev;
> +	setup_timer(&devpriv->timer, waveform_ai_interrupt,
> +		    (unsigned long)dev);
>  
>  	dev_info(dev->class_dev,
>  		 "%s: %i microvolt, %li microsecond waveform attached\n",
> -- 
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150219000733.GA14360%40localhost.localdomain.
> For more options, visit https://groups.google.com/d/optout.
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-19  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19  0:07 [PATCH v3] staging: comedi: drivers: replace init_timer by setup_timer Aya Mahfouz
2015-02-19  6:56 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.