Skip to contentSkip to conversation

drm: gma500: Convert timers to use timer_setup()

PATCH Applied Kees Cook 2 participants 6 messages Oct 24, 2017 – Nov 1, 2017

Subsystems (3)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 drm: gma500: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/gma500/psb_lid.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/psb_lid.c +3 -5
index 1d2ebb5e530f..be6dda58fcae 100644
@@ -23,9 +23,9 @@
 #include "psb_intel_reg.h"
 #include <linux/spinlock.h>
 
-static void psb_lid_timer_func(unsigned long data)
+static void psb_lid_timer_func(struct timer_list *t)
 {
-	struct drm_psb_private * dev_priv = (struct drm_psb_private *)data;
+	struct drm_psb_private *dev_priv = from_timer(dev_priv, t, lid_timer);
 	struct drm_device *dev = (struct drm_device *)dev_priv->dev;
 	struct timer_list *lid_timer = &dev_priv->lid_timer;
 	unsigned long irq_flags;
@@ -77,10 +77,8 @@ void psb_lid_timer_init(struct drm_psb_private *dev_priv)
 	spin_lock_init(&dev_priv->lid_lock);
 	spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
 
-	init_timer(lid_timer);
+	timer_setup(lid_timer, psb_lid_timer_func, 0);
 
-	lid_timer->data = (unsigned long)dev_priv;
-	lid_timer->function = psb_lid_timer_func;
 	lid_timer->expires = jiffies + PSB_LID_DELAY;
 
 	add_timer(lid_timer);
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
#1 lore raw
Quoted 8 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>

Do you expect drm folks to apply this, or is this part of a larger refactoring?

A notch more context in the commit message would help ... -Daniel

Quoted 43 lines
---
 drivers/gpu/drm/gma500/psb_lid.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/psb_lid.c +3 -5
index 1d2ebb5e530f..be6dda58fcae 100644
@@ -23,9 +23,9 @@
 #include "psb_intel_reg.h"
 #include <linux/spinlock.h>
 
-static void psb_lid_timer_func(unsigned long data)
+static void psb_lid_timer_func(struct timer_list *t)
 {
-	struct drm_psb_private * dev_priv = (struct drm_psb_private *)data;
+	struct drm_psb_private *dev_priv = from_timer(dev_priv, t, lid_timer);
 	struct drm_device *dev = (struct drm_device *)dev_priv->dev;
 	struct timer_list *lid_timer = &dev_priv->lid_timer;
 	unsigned long irq_flags;
@@ -77,10 +77,8 @@ void psb_lid_timer_init(struct drm_psb_private *dev_priv)
 	spin_lock_init(&dev_priv->lid_lock);
 	spin_lock_irqsave(&dev_priv->lid_lock, irq_flags);
 
-	init_timer(lid_timer);
+	timer_setup(lid_timer, psb_lid_timer_func, 0);
 
-	lid_timer->data = (unsigned long)dev_priv;
-	lid_timer->function = psb_lid_timer_func;
 	lid_timer->expires = jiffies + PSB_LID_DELAY;
 
 	add_timer(lid_timer);
Signature · 10 lines
2.7.4


-- 
Kees Cook
Pixel Security
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 8 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>

Do you expect drm folks to apply this, or is this part of a larger refactoring?

If the drm tree includes -rc3, you can carry these. If you don't want to carry these and want the timer tree to carry them, we can do that too.

Quoted 1 line

A notch more context in the commit message would help ...

Sorry about that, my added context for this go lost in later conversion patches.

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#3 lore raw
Quoted 11 lines · Kees Cook
Quoted 10 lines · Daniel Vetter
Quoted 8 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>
Quoted 5 lines
Quoted 1 line

Do you expect drm folks to apply this, or is this part of a larger refactoring?

If the drm tree includes -rc3, you can carry these. If you don't want to carry these and want the timer tree to carry them, we can do that too.

Applied to drm-misc-next for 4.16 (we're way past freeze for 4.15 already).

Thanks, Daniel

Quoted 14 lines
Quoted 2 lines

A notch more context in the commit message would help ...

Sorry about that, my added context for this go lost in later conversion patches.

-Kees

Signature · 6 lines
Kees Cook
Pixel Security
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#4 lore raw
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Kees Cook
Quoted 10 lines · Daniel Vetter
Quoted 8 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Do you expect drm folks to apply this, or is this part of a larger refactoring?

If the drm tree includes -rc3, you can carry these. If you don't want to carry these and want the timer tree to carry them, we can do that too.

Applied to drm-misc-next for 4.16 (we're way past freeze for 4.15 already).

Since this is one of the few remaining "non-trivial" users of the ancient init_timer() API, would you mind if the timers tree carried this for 4.15? I'm trying to entirely remove the init_timer() API (and if I can, remove the old setup_*timer() API too).

Thanks!

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
Acked-by
#5 lore raw
Quoted 19 lines · Kees Cook
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Kees Cook
Quoted 11 lines · Daniel Vetter
Quoted 8 lines · Kees Cook

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>

Do you expect drm folks to apply this, or is this part of a larger refactoring?

If the drm tree includes -rc3, you can carry these. If you don't want to carry these and want the timer tree to carry them, we can do that too.

Quoted 7 lines
Quoted 2 lines

Applied to drm-misc-next for 4.16 (we're way past freeze for 4.15 already).

Since this is one of the few remaining "non-trivial" users of the ancient init_timer() API, would you mind if the timers tree carried this for 4.15? I'm trying to entirely remove the init_timer() API (and if I can, remove the old setup_*timer() API too).

I was contemplating before applying it whether I should ask ...

Oh well, problem is that drm-misc is non-rebasing, but you can just apply it twice. git usually figures it out.

in case you do so.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch