All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: comedi: drivers: replace init_timer by setup_timer
@ 2015-02-18 18:29 Aya Mahfouz
  2015-02-18 22:26 ` [Outreachy kernel] " Jes Sorensen
  0 siblings, 1 reply; 3+ messages in thread
From: Aya Mahfouz @ 2015-02-18 18:29 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 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>
---
v2: changed commit message and picked Julia'a ack

 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] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH v2] staging: comedi: drivers: replace init_timer by setup_timer
  2015-02-18 18:29 [PATCH v2] staging: comedi: drivers: replace init_timer by setup_timer Aya Mahfouz
@ 2015-02-18 22:26 ` Jes Sorensen
  2015-02-18 23:52   ` Aya Mahfouz
  0 siblings, 1 reply; 3+ messages in thread
From: Jes Sorensen @ 2015-02-18 22:26 UTC (permalink / raw)
  To: Aya Mahfouz, outreachy-kernel

On 02/18/15 13:29, 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 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>
> ---
> v2: changed commit message and picked Julia'a ack

Looks good to me - the only minor issue is the commit message. I would
make it say:

"
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:
"

Cheers,
Jes

>  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",
> 



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

* Re: [Outreachy kernel] [PATCH v2] staging: comedi: drivers: replace init_timer by setup_timer
  2015-02-18 22:26 ` [Outreachy kernel] " Jes Sorensen
@ 2015-02-18 23:52   ` Aya Mahfouz
  0 siblings, 0 replies; 3+ messages in thread
From: Aya Mahfouz @ 2015-02-18 23:52 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: outreachy-kernel

On Wed, Feb 18, 2015 at 05:26:14PM -0500, Jes Sorensen wrote:
> On 02/18/15 13:29, 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 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>
> > ---
> > v2: changed commit message and picked Julia'a ack
> 
> Looks good to me - the only minor issue is the commit message. I would
> make it say:
> 
> "
> 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:
> "
> 
> Cheers,
> Jes
> 
Thanks will do!

Kind Regards,
Aya Saif El-yazal Mahfouz

> >  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",
> > 
> 


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

end of thread, other threads:[~2015-02-18 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 18:29 [PATCH v2] staging: comedi: drivers: replace init_timer by setup_timer Aya Mahfouz
2015-02-18 22:26 ` [Outreachy kernel] " Jes Sorensen
2015-02-18 23:52   ` Aya Mahfouz

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.