All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] driver:garmin gps: use setup_timer
@ 2017-09-21 11:24 Allen Pais
  2017-10-09 13:59 ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Allen Pais @ 2017-09-21 11:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: johan, gregkh, Allen Pais

    Use setup_timer function instead of initializing timer with the
    function and data fields.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index b2f2e87..2dbc1bed 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1391,12 +1391,11 @@ static int garmin_port_probe(struct usb_serial_port *port)
 	if (!garmin_data_p)
 		return -ENOMEM;
 
-	init_timer(&garmin_data_p->timer);
+	setup_timer(&garmin_data_p->timer, timeout_handler,
+		    (unsigned long)garmin_data_p);
 	spin_lock_init(&garmin_data_p->lock);
 	INIT_LIST_HEAD(&garmin_data_p->pktlist);
 	/* garmin_data_p->timer.expires = jiffies + session_timeout; */
-	garmin_data_p->timer.data = (unsigned long)garmin_data_p;
-	garmin_data_p->timer.function = timeout_handler;
 	garmin_data_p->port = port;
 	garmin_data_p->state = 0;
 	garmin_data_p->flags = 0;
-- 
2.7.4

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

* Re: [PATCH 1/1] driver:garmin gps: use setup_timer
  2017-09-21 11:24 [PATCH 1/1] driver:garmin gps: use setup_timer Allen Pais
@ 2017-10-09 13:59 ` Johan Hovold
  2017-10-09 16:34   ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2017-10-09 13:59 UTC (permalink / raw)
  To: Allen Pais; +Cc: linux-kernel, johan, gregkh, Kees Cook

On Thu, Sep 21, 2017 at 04:54:24PM +0530, Allen Pais wrote:
>     Use setup_timer function instead of initializing timer with the
>     function and data fields.

Why the odd indentation here?

> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
> ---
>  drivers/usb/serial/garmin_gps.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
> index b2f2e87..2dbc1bed 100644
> --- a/drivers/usb/serial/garmin_gps.c
> +++ b/drivers/usb/serial/garmin_gps.c
> @@ -1391,12 +1391,11 @@ static int garmin_port_probe(struct usb_serial_port *port)
>  	if (!garmin_data_p)
>  		return -ENOMEM;
>  
> -	init_timer(&garmin_data_p->timer);
> +	setup_timer(&garmin_data_p->timer, timeout_handler,
> +		    (unsigned long)garmin_data_p);
>  	spin_lock_init(&garmin_data_p->lock);
>  	INIT_LIST_HEAD(&garmin_data_p->pktlist);
>  	/* garmin_data_p->timer.expires = jiffies + session_timeout; */
> -	garmin_data_p->timer.data = (unsigned long)garmin_data_p;
> -	garmin_data_p->timer.function = timeout_handler;
>  	garmin_data_p->port = port;
>  	garmin_data_p->state = 0;
>  	garmin_data_p->flags = 0;

Kees submitted the exact same change the day before you as part of a
larger patch resulting from running coccinelle and replacing all
open-coded versions of setup_timer in go, something which seems
preferable.

Not sure who is expected to pick that patch up, but I'll hold off on
this one for a while still waiting to see what happens to Kees's series.

Thanks,
Johan

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

* Re: [PATCH 1/1] driver:garmin gps: use setup_timer
  2017-10-09 13:59 ` Johan Hovold
@ 2017-10-09 16:34   ` Kees Cook
  2017-10-10  6:54     ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-09 16:34 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Allen Pais, LKML, Greg KH

On Mon, Oct 9, 2017 at 6:59 AM, Johan Hovold <johan@kernel.org> wrote:
> On Thu, Sep 21, 2017 at 04:54:24PM +0530, Allen Pais wrote:
>>     Use setup_timer function instead of initializing timer with the
>>     function and data fields.
>
> Why the odd indentation here?
>
>> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
>> ---
>>  drivers/usb/serial/garmin_gps.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
>> index b2f2e87..2dbc1bed 100644
>> --- a/drivers/usb/serial/garmin_gps.c
>> +++ b/drivers/usb/serial/garmin_gps.c
>> @@ -1391,12 +1391,11 @@ static int garmin_port_probe(struct usb_serial_port *port)
>>       if (!garmin_data_p)
>>               return -ENOMEM;
>>
>> -     init_timer(&garmin_data_p->timer);
>> +     setup_timer(&garmin_data_p->timer, timeout_handler,
>> +                 (unsigned long)garmin_data_p);
>>       spin_lock_init(&garmin_data_p->lock);
>>       INIT_LIST_HEAD(&garmin_data_p->pktlist);
>>       /* garmin_data_p->timer.expires = jiffies + session_timeout; */
>> -     garmin_data_p->timer.data = (unsigned long)garmin_data_p;
>> -     garmin_data_p->timer.function = timeout_handler;
>>       garmin_data_p->port = port;
>>       garmin_data_p->state = 0;
>>       garmin_data_p->flags = 0;
>
> Kees submitted the exact same change the day before you as part of a
> larger patch resulting from running coccinelle and replacing all
> open-coded versions of setup_timer in go, something which seems
> preferable.
>
> Not sure who is expected to pick that patch up, but I'll hold off on
> this one for a while still waiting to see what happens to Kees's series.

Hi, actually, "setup_timer" is the old api ("init_timer" is the
ancient api), "timer_setup" (to match hrtimer_setup) is the current
future approach here...

-Kees

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH 1/1] driver:garmin gps: use setup_timer
  2017-10-09 16:34   ` Kees Cook
@ 2017-10-10  6:54     ` Johan Hovold
  2017-10-10 14:23       ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2017-10-10  6:54 UTC (permalink / raw)
  To: Kees Cook; +Cc: Johan Hovold, Allen Pais, LKML, Greg KH

On Mon, Oct 09, 2017 at 09:34:05AM -0700, Kees Cook wrote:
> On Mon, Oct 9, 2017 at 6:59 AM, Johan Hovold <johan@kernel.org> wrote:
> > On Thu, Sep 21, 2017 at 04:54:24PM +0530, Allen Pais wrote:
> >>     Use setup_timer function instead of initializing timer with the
> >>     function and data fields.
> >
> > Why the odd indentation here?
> >
> >> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
> >> ---
> >>  drivers/usb/serial/garmin_gps.c | 5 ++---
> >>  1 file changed, 2 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
> >> index b2f2e87..2dbc1bed 100644
> >> --- a/drivers/usb/serial/garmin_gps.c
> >> +++ b/drivers/usb/serial/garmin_gps.c
> >> @@ -1391,12 +1391,11 @@ static int garmin_port_probe(struct usb_serial_port *port)
> >>       if (!garmin_data_p)
> >>               return -ENOMEM;
> >>
> >> -     init_timer(&garmin_data_p->timer);
> >> +     setup_timer(&garmin_data_p->timer, timeout_handler,
> >> +                 (unsigned long)garmin_data_p);
> >>       spin_lock_init(&garmin_data_p->lock);
> >>       INIT_LIST_HEAD(&garmin_data_p->pktlist);
> >>       /* garmin_data_p->timer.expires = jiffies + session_timeout; */
> >> -     garmin_data_p->timer.data = (unsigned long)garmin_data_p;
> >> -     garmin_data_p->timer.function = timeout_handler;
> >>       garmin_data_p->port = port;
> >>       garmin_data_p->state = 0;
> >>       garmin_data_p->flags = 0;
> >
> > Kees submitted the exact same change the day before you as part of a
> > larger patch resulting from running coccinelle and replacing all
> > open-coded versions of setup_timer in go, something which seems
> > preferable.
> >
> > Not sure who is expected to pick that patch up, but I'll hold off on
> > this one for a while still waiting to see what happens to Kees's series.
> 
> Hi, actually, "setup_timer" is the old api ("init_timer" is the
> ancient api), "timer_setup" (to match hrtimer_setup) is the current
> future approach here...

So your patch from 20/9 ("[PATCH v2 02/31] timer: Convert open-coded
init_timer() to setup_timer()") has been superseded? Or do you still
expect that one to be applied (by tglx?)?

Johan

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

* Re: [PATCH 1/1] driver:garmin gps: use setup_timer
  2017-10-10  6:54     ` Johan Hovold
@ 2017-10-10 14:23       ` Kees Cook
  2017-10-10 16:17         ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-10 14:23 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Allen Pais, LKML, Greg KH

On Mon, Oct 9, 2017 at 11:54 PM, Johan Hovold <johan@kernel.org> wrote:
> So your patch from 20/9 ("[PATCH v2 02/31] timer: Convert open-coded
> init_timer() to setup_timer()") has been superseded? Or do you still
> expect that one to be applied (by tglx?)?

It's been superseded, yeah. Thomas suggested a change to the
conversion steps, so I'm hoping to move entirely to timer_setup()
directly.

-Kees

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH 1/1] driver:garmin gps: use setup_timer
  2017-10-10 14:23       ` Kees Cook
@ 2017-10-10 16:17         ` Johan Hovold
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2017-10-10 16:17 UTC (permalink / raw)
  To: Kees Cook; +Cc: Johan Hovold, Allen Pais, LKML, Greg KH

On Tue, Oct 10, 2017 at 07:23:26AM -0700, Kees Cook wrote:
> On Mon, Oct 9, 2017 at 11:54 PM, Johan Hovold <johan@kernel.org> wrote:
> > So your patch from 20/9 ("[PATCH v2 02/31] timer: Convert open-coded
> > init_timer() to setup_timer()") has been superseded? Or do you still
> > expect that one to be applied (by tglx?)?
> 
> It's been superseded, yeah. Thomas suggested a change to the
> conversion steps, so I'm hoping to move entirely to timer_setup()
> directly.

Good. I'll drop this patch then and wait for a timer_setup conversion
instead.

Thanks,
Johan

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

end of thread, other threads:[~2017-10-10 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 11:24 [PATCH 1/1] driver:garmin gps: use setup_timer Allen Pais
2017-10-09 13:59 ` Johan Hovold
2017-10-09 16:34   ` Kees Cook
2017-10-10  6:54     ` Johan Hovold
2017-10-10 14:23       ` Kees Cook
2017-10-10 16:17         ` Johan Hovold

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.