linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: gma500: Convert timers to use timer_setup()
@ 2017-10-24 15:16 Kees Cook
  2017-10-30 10:08 ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-24 15:16 UTC (permalink / raw)
  To: Patrik Jakobsson; +Cc: David Airlie, dri-devel, linux-kernel

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 <patrik.r.jakobsson@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/gpu/drm/gma500/psb_lid.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/gma500/psb_lid.c b/drivers/gpu/drm/gma500/psb_lid.c
index 1d2ebb5e530f..be6dda58fcae 100644
--- a/drivers/gpu/drm/gma500/psb_lid.c
+++ b/drivers/gpu/drm/gma500/psb_lid.c
@@ -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);
-- 
2.7.4


-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] drm: gma500: Convert timers to use timer_setup()
  2017-10-24 15:16 [PATCH] drm: gma500: Convert timers to use timer_setup() Kees Cook
@ 2017-10-30 10:08 ` Daniel Vetter
  2017-10-30 22:05   ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2017-10-30 10:08 UTC (permalink / raw)
  To: Kees Cook; +Cc: Patrik Jakobsson, linux-kernel, dri-devel

On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
> 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 <patrik.r.jakobsson@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

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

> ---
>  drivers/gpu/drm/gma500/psb_lid.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/psb_lid.c b/drivers/gpu/drm/gma500/psb_lid.c
> index 1d2ebb5e530f..be6dda58fcae 100644
> --- a/drivers/gpu/drm/gma500/psb_lid.c
> +++ b/drivers/gpu/drm/gma500/psb_lid.c
> @@ -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);
> -- 
> 2.7.4
> 
> 
> -- 
> Kees Cook
> Pixel Security
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm: gma500: Convert timers to use timer_setup()
  2017-10-30 10:08 ` Daniel Vetter
@ 2017-10-30 22:05   ` Kees Cook
  2017-10-31 10:18     ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-30 22:05 UTC (permalink / raw)
  To: Kees Cook, Patrik Jakobsson, LKML, Maling list - DRI developers

On Mon, Oct 30, 2017 at 3:08 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
>> 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 <patrik.r.jakobsson@gmail.com>
>> Cc: David Airlie <airlied@linux.ie>
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> 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.

> 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

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] drm: gma500: Convert timers to use timer_setup()
  2017-10-30 22:05   ` Kees Cook
@ 2017-10-31 10:18     ` Daniel Vetter
  2017-10-31 15:08       ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2017-10-31 10:18 UTC (permalink / raw)
  To: Kees Cook; +Cc: Patrik Jakobsson, LKML, Maling list - DRI developers

On Mon, Oct 30, 2017 at 03:05:29PM -0700, Kees Cook wrote:
> On Mon, Oct 30, 2017 at 3:08 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
> >> 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 <patrik.r.jakobsson@gmail.com>
> >> Cc: David Airlie <airlied@linux.ie>
> >> Cc: dri-devel@lists.freedesktop.org
> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >
> > 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

> 
> > 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
> 
> -- 
> Kees Cook
> Pixel Security
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm: gma500: Convert timers to use timer_setup()
  2017-10-31 10:18     ` Daniel Vetter
@ 2017-10-31 15:08       ` Kees Cook
  2017-11-01  9:02         ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2017-10-31 15:08 UTC (permalink / raw)
  To: Kees Cook, Patrik Jakobsson, LKML, Maling list - DRI developers

On Tue, Oct 31, 2017 at 3:18 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Oct 30, 2017 at 03:05:29PM -0700, Kees Cook wrote:
>> On Mon, Oct 30, 2017 at 3:08 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
>> > On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
>> >> 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 <patrik.r.jakobsson@gmail.com>
>> >> Cc: David Airlie <airlied@linux.ie>
>> >> Cc: dri-devel@lists.freedesktop.org
>> >> Signed-off-by: Kees Cook <keescook@chromium.org>
>> >
>> > 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

-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] drm: gma500: Convert timers to use timer_setup()
  2017-10-31 15:08       ` Kees Cook
@ 2017-11-01  9:02         ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2017-11-01  9:02 UTC (permalink / raw)
  To: Kees Cook; +Cc: Patrik Jakobsson, LKML, Maling list - DRI developers

On Tue, Oct 31, 2017 at 08:08:14AM -0700, Kees Cook wrote:
> On Tue, Oct 31, 2017 at 3:18 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Oct 30, 2017 at 03:05:29PM -0700, Kees Cook wrote:
> >> On Mon, Oct 30, 2017 at 3:08 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> >> > On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
> >> >> 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 <patrik.r.jakobsson@gmail.com>
> >> >> Cc: David Airlie <airlied@linux.ie>
> >> >> Cc: dri-devel@lists.freedesktop.org
> >> >> Signed-off-by: Kees Cook <keescook@chromium.org>
> >> >
> >> > 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).

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.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

in case you do so.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2017-11-01  9:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 15:16 [PATCH] drm: gma500: Convert timers to use timer_setup() Kees Cook
2017-10-30 10:08 ` Daniel Vetter
2017-10-30 22:05   ` Kees Cook
2017-10-31 10:18     ` Daniel Vetter
2017-10-31 15:08       ` Kees Cook
2017-11-01  9:02         ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).