All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: cpwd: Convert timers to use timer_setup()
@ 2017-10-25 10:32 Kees Cook
  2017-10-25 10:38 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2017-10-25 10:32 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, 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. Switches to using the global that is
used everywhere else.

Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/watchdog/cpwd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index 3d43775548e5..aee0b25cf10d 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -230,9 +230,9 @@ static void cpwd_resetbrokentimer(struct cpwd *p, int index)
  * interrupts within the PLD so me must continually
  * reset the timers ad infinitum.
  */
-static void cpwd_brokentimer(unsigned long data)
+static void cpwd_brokentimer(struct timer_list *unused)
 {
-	struct cpwd *p = (struct cpwd *) data;
+	struct cpwd *p = cpwd_device;
 	int id, tripped = 0;
 
 	/* kill a running timer instance, in case we
@@ -275,7 +275,7 @@ static void cpwd_stoptimer(struct cpwd *p, int index)
 
 		if (p->broken) {
 			p->devs[index].runstatus |= WD_STAT_BSTOP;
-			cpwd_brokentimer((unsigned long) p);
+			cpwd_brokentimer(NULL);
 		}
 	}
 }
@@ -608,7 +608,7 @@ static int cpwd_probe(struct platform_device *op)
 	}
 
 	if (p->broken) {
-		setup_timer(&cpwd_timer, cpwd_brokentimer, (unsigned long)p);
+		timer_setup(&cpwd_timer, cpwd_brokentimer, 0);
 		cpwd_timer.expires	= WD_BTIMEOUT;
 
 		pr_info("PLD defect workaround enabled for model %s\n",
-- 
2.7.4


-- 
Kees Cook
Pixel Security

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

* Re: [PATCH] watchdog: cpwd: Convert timers to use timer_setup()
  2017-10-25 10:32 [PATCH] watchdog: cpwd: Convert timers to use timer_setup() Kees Cook
@ 2017-10-25 10:38 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2017-10-25 10:38 UTC (permalink / raw)
  To: Kees Cook; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On 10/25/2017 03:32 AM, 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. Switches to using the global that is
> used everywhere else.
> 
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/cpwd.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
> index 3d43775548e5..aee0b25cf10d 100644
> --- a/drivers/watchdog/cpwd.c
> +++ b/drivers/watchdog/cpwd.c
> @@ -230,9 +230,9 @@ static void cpwd_resetbrokentimer(struct cpwd *p, int index)
>    * interrupts within the PLD so me must continually
>    * reset the timers ad infinitum.
>    */
> -static void cpwd_brokentimer(unsigned long data)
> +static void cpwd_brokentimer(struct timer_list *unused)
>   {
> -	struct cpwd *p = (struct cpwd *) data;
> +	struct cpwd *p = cpwd_device;
>   	int id, tripped = 0;
>   
>   	/* kill a running timer instance, in case we
> @@ -275,7 +275,7 @@ static void cpwd_stoptimer(struct cpwd *p, int index)
>   
>   		if (p->broken) {
>   			p->devs[index].runstatus |= WD_STAT_BSTOP;
> -			cpwd_brokentimer((unsigned long) p);
> +			cpwd_brokentimer(NULL);
>   		}
>   	}
>   }
> @@ -608,7 +608,7 @@ static int cpwd_probe(struct platform_device *op)
>   	}
>   
>   	if (p->broken) {
> -		setup_timer(&cpwd_timer, cpwd_brokentimer, (unsigned long)p);
> +		timer_setup(&cpwd_timer, cpwd_brokentimer, 0);
>   		cpwd_timer.expires	= WD_BTIMEOUT;
>   
>   		pr_info("PLD defect workaround enabled for model %s\n",
> 

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-25 10:32 [PATCH] watchdog: cpwd: Convert timers to use timer_setup() Kees Cook
2017-10-25 10:38 ` Guenter Roeck

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.