Skip to contentSkip to conversation

driver:garmin gps: use setup_timer

PATCH In review Allen Pais 3 participants 6 messages Sep 21, 2017 – Oct 10, 2017

Subsystems (2)
lore
Share & tools
lore

Allen Pais

author
#0 lore raw

PATCH 1/1 driver:garmin gps: use setup_timer

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

---
 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/serial/garmin_gps.c +2 -3
index b2f2e87..2dbc1bed 100644
@@ -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;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 2 lines · Allen Pais

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

Why the odd indentation here?

Quoted 14 lines
---
 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/serial/garmin_gps.c +0 -1
index b2f2e87..2dbc1bed 100644
@@ -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);

drivers/usb/serial/garmin_gps.c static int garmin_port_probe(struct usb_serial_port *port) · line 1401

Quoted 10 lines
drivers/usb/serial/garmin_gps.c +2 -2
+	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

#2 lore raw
Quoted 36 lines · Johan Hovold
Quoted 2 lines · Allen Pais

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

Why the odd indentation here?

Quoted 14 lines
---
 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/serial/garmin_gps.c +0 -1
index b2f2e87..2dbc1bed 100644
@@ -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);

drivers/usb/serial/garmin_gps.c static int garmin_port_probe(struct usb_serial_port *port) · line 1401

Quoted 10 lines
drivers/usb/serial/garmin_gps.c +2 -2
+     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.

Quoted 2 lines

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

Signature · 2 lines
Kees Cook
Pixel Security
maintainer
#3 lore raw
Quoted 37 lines · Kees Cook
Quoted 36 lines · Johan Hovold
Quoted 2 lines · Allen Pais

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

Why the odd indentation here?

Quoted 14 lines
---
 drivers/usb/serial/garmin_gps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/serial/garmin_gps.c +0 -1
index b2f2e87..2dbc1bed 100644
@@ -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);

drivers/usb/serial/garmin_gps.c static int garmin_port_probe(struct usb_serial_port *port) · line 1401

Quoted 10 lines
drivers/usb/serial/garmin_gps.c +2 -2
+     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.

Quoted 6 lines
Quoted 2 lines

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

#4 lore raw
Quoted 3 lines · Johan Hovold

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

Signature · 2 lines
Kees Cook
Pixel Security
maintainer
#5 lore raw
Quoted 8 lines · Kees Cook
Quoted 3 lines · Johan Hovold

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