Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer
       [not found] <1504222183-61202-1-git-send-email-keescook@chromium.org>
@ 2017-08-31 23:29 ` Kees Cook
  2017-09-01  7:04   ` Ralf Baechle
  2017-09-01 22:56   ` Ralf Baechle
  2017-08-31 23:29 ` [PATCH 24/31] mips/sgi-ip22: " Kees Cook
  1 sibling, 2 replies; 7+ messages in thread
From: Kees Cook @ 2017-08-31 23:29 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Ralf Baechle, Ingo Molnar, Arnd Bergmann, linux-mips,
	linux-kernel

In preparation for changing the timer callback argument to the timer
pointer, move to a separate static data variable.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-mips@linux-mips.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/mips/sgi-ip32/ip32-reset.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 4e263fd4deff..6636a9c686cd 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -38,6 +38,7 @@
 extern struct platform_device ip32_rtc_device;
 
 static struct timer_list power_timer, blink_timer;
+static unsigned long blink_timer_timeout;
 static int has_panicked, shutting_down;
 
 static __noreturn void ip32_poweroff(void *data)
@@ -71,11 +72,11 @@ static void ip32_machine_restart(char *cmd)
 	unreachable();
 }
 
-static void blink_timeout(unsigned long data)
+static void blink_timeout(unsigned long unused)
 {
 	unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
 	mace->perif.ctrl.misc = led;
-	mod_timer(&blink_timer, jiffies + data);
+	mod_timer(&blink_timer, jiffies + blink_timer_timeout);
 }
 
 static void ip32_machine_halt(void)
@@ -99,8 +100,8 @@ void ip32_prepare_poweroff(void)
 	}
 
 	shutting_down = 1;
-	blink_timer.data = POWERDOWN_FREQ;
-	blink_timeout(POWERDOWN_FREQ);
+	blink_timer_timeout = POWERDOWN_FREQ;
+	blink_timeout(0);
 
 	setup_timer(&power_timer, power_timeout, 0UL);
 	power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
@@ -120,8 +121,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
 	led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
 	mace->perif.ctrl.misc = led;
 
-	blink_timer.data = PANIC_FREQ;
-	blink_timeout(PANIC_FREQ);
+	blink_timer_timeout = PANIC_FREQ;
+	blink_timeout(0);
 
 	return NOTIFY_DONE;
 }
@@ -142,8 +143,7 @@ static __init int ip32_reboot_setup(void)
 	_machine_halt = ip32_machine_halt;
 	pm_power_off = ip32_machine_halt;
 
-	init_timer(&blink_timer);
-	blink_timer.function = blink_timeout;
+	setup_timer(&blink_timer, blink_timeout, 0);
 	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
 
 	return 0;
-- 
2.7.4

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

* [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer
       [not found] <1504222183-61202-1-git-send-email-keescook@chromium.org>
  2017-08-31 23:29 ` [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer Kees Cook
@ 2017-08-31 23:29 ` Kees Cook
  2017-09-01  6:59   ` Ralf Baechle
  2017-09-01 22:56   ` Ralf Baechle
  1 sibling, 2 replies; 7+ messages in thread
From: Kees Cook @ 2017-08-31 23:29 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Ralf Baechle, James Hogan, Ingo Molnar, Paul Gortmaker,
	linux-mips, linux-kernel

In preparation for changing the timer callback argument to the timer
pointer, move to a separate static data variable.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/mips/sgi-ip22/ip22-reset.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 196b041866ac..5cc32610e6d3 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -38,6 +38,7 @@
 #define PANIC_FREQ		(HZ / 8)
 
 static struct timer_list power_timer, blink_timer, debounce_timer;
+static unsigned long blink_timer_timeout;
 
 #define MACHINE_PANICED		1
 #define MACHINE_SHUTTING_DOWN	2
@@ -86,13 +87,13 @@ static void power_timeout(unsigned long data)
 	sgi_machine_power_off();
 }
 
-static void blink_timeout(unsigned long data)
+static void blink_timeout(unsigned long unused)
 {
 	/* XXX fix this for fullhouse  */
 	sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
 	sgioc->reset = sgi_ioc_reset;
 
-	mod_timer(&blink_timer, jiffies + data);
+	mod_timer(&blink_timer, jiffies + blink_timer_timeout);
 }
 
 static void debounce(unsigned long data)
@@ -128,8 +129,8 @@ static inline void power_button(void)
 	}
 
 	machine_state |= MACHINE_SHUTTING_DOWN;
-	blink_timer.data = POWERDOWN_FREQ;
-	blink_timeout(POWERDOWN_FREQ);
+	blink_timer_timeout = POWERDOWN_FREQ;
+	blink_timeout(0);
 
 	setup_timer(&power_timer, power_timeout, 0UL);
 	power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
@@ -169,8 +170,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
 		return NOTIFY_DONE;
 	machine_state |= MACHINE_PANICED;
 
-	blink_timer.data = PANIC_FREQ;
-	blink_timeout(PANIC_FREQ);
+	blink_timer_timeout = PANIC_FREQ;
+	blink_timeout(0);
 
 	return NOTIFY_DONE;
 }
@@ -193,8 +194,7 @@ static int __init reboot_setup(void)
 		return res;
 	}
 
-	init_timer(&blink_timer);
-	blink_timer.function = blink_timeout;
+	setup_timer(&blink_timer, blink_timeout, 0);
 	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
 
 	return 0;
-- 
2.7.4

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

* Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer
  2017-08-31 23:29 ` [PATCH 24/31] mips/sgi-ip22: " Kees Cook
@ 2017-09-01  6:59   ` Ralf Baechle
  2017-09-01 16:57     ` Kees Cook
  2017-09-01 22:56   ` Ralf Baechle
  1 sibling, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2017-09-01  6:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, James Hogan, Ingo Molnar, Paul Gortmaker,
	linux-mips, linux-kernel

On Thu, Aug 31, 2017 at 04:29:36PM -0700, Kees Cook wrote:

> In preparation for changing the timer callback argument to the timer
> pointer, move to a separate static data variable.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
> Cc: linux-mips@linux-mips.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/mips/sgi-ip22/ip22-reset.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
> index 196b041866ac..5cc32610e6d3 100644
> --- a/arch/mips/sgi-ip22/ip22-reset.c
> +++ b/arch/mips/sgi-ip22/ip22-reset.c
> @@ -38,6 +38,7 @@
>  #define PANIC_FREQ		(HZ / 8)
>  
>  static struct timer_list power_timer, blink_timer, debounce_timer;
> +static unsigned long blink_timer_timeout;

You're removing power_timer and debounce_timer ...

>  #define MACHINE_PANICED		1
>  #define MACHINE_SHUTTING_DOWN	2
> @@ -86,13 +87,13 @@ static void power_timeout(unsigned long data)
>  	sgi_machine_power_off();
>  }
>  
> -static void blink_timeout(unsigned long data)
> +static void blink_timeout(unsigned long unused)
>  {
>  	/* XXX fix this for fullhouse  */
>  	sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
>  	sgioc->reset = sgi_ioc_reset;
>  
> -	mod_timer(&blink_timer, jiffies + data);
> +	mod_timer(&blink_timer, jiffies + blink_timer_timeout);
>  }
>  
>  static void debounce(unsigned long data)
> @@ -128,8 +129,8 @@ static inline void power_button(void)
>  	}
>  
>  	machine_state |= MACHINE_SHUTTING_DOWN;
> -	blink_timer.data = POWERDOWN_FREQ;
> -	blink_timeout(POWERDOWN_FREQ);
> +	blink_timer_timeout = POWERDOWN_FREQ;
> +	blink_timeout(0);
>  
>  	setup_timer(&power_timer, power_timeout, 0UL);

... but don't remove the reference to power_timer nor use of debounce_timer.

>  	power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
> @@ -169,8 +170,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
>  		return NOTIFY_DONE;
>  	machine_state |= MACHINE_PANICED;
>  
> -	blink_timer.data = PANIC_FREQ;
> -	blink_timeout(PANIC_FREQ);
> +	blink_timer_timeout = PANIC_FREQ;
> +	blink_timeout(0);
>  
>  	return NOTIFY_DONE;
>  }
> @@ -193,8 +194,7 @@ static int __init reboot_setup(void)
>  		return res;
>  	}
>  
> -	init_timer(&blink_timer);
> -	blink_timer.function = blink_timeout;
> +	setup_timer(&blink_timer, blink_timeout, 0);
>  	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>  
>  	return 0;

  Ralf

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

* Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer
  2017-08-31 23:29 ` [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer Kees Cook
@ 2017-09-01  7:04   ` Ralf Baechle
  2017-09-01 22:56   ` Ralf Baechle
  1 sibling, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2017-09-01  7:04 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Ingo Molnar, Arnd Bergmann, linux-mips,
	linux-kernel

On Thu, Aug 31, 2017 at 04:29:35PM -0700, Kees Cook wrote:

> In preparation for changing the timer callback argument to the timer
> pointer, move to a separate static data variable.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-mips@linux-mips.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/mips/sgi-ip32/ip32-reset.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
> index 4e263fd4deff..6636a9c686cd 100644
> --- a/arch/mips/sgi-ip32/ip32-reset.c
> +++ b/arch/mips/sgi-ip32/ip32-reset.c
> @@ -38,6 +38,7 @@
>  extern struct platform_device ip32_rtc_device;
>  
>  static struct timer_list power_timer, blink_timer;
> +static unsigned long blink_timer_timeout;

Similar to the IP22 patch this patch removes power_timer ...

>  static int has_panicked, shutting_down;
>  
>  static __noreturn void ip32_poweroff(void *data)
> @@ -71,11 +72,11 @@ static void ip32_machine_restart(char *cmd)
>  	unreachable();
>  }
>  
> -static void blink_timeout(unsigned long data)
> +static void blink_timeout(unsigned long unused)
>  {
>  	unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
>  	mace->perif.ctrl.misc = led;
> -	mod_timer(&blink_timer, jiffies + data);
> +	mod_timer(&blink_timer, jiffies + blink_timer_timeout);
>  }
>  
>  static void ip32_machine_halt(void)
> @@ -99,8 +100,8 @@ void ip32_prepare_poweroff(void)
>  	}
>  
>  	shutting_down = 1;
> -	blink_timer.data = POWERDOWN_FREQ;
> -	blink_timeout(POWERDOWN_FREQ);
> +	blink_timer_timeout = POWERDOWN_FREQ;
> +	blink_timeout(0);
>  
>  	setup_timer(&power_timer, power_timeout, 0UL);

... but doesn't fix the users.

>  	power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
> @@ -120,8 +121,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
>  	led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
>  	mace->perif.ctrl.misc = led;
>  
> -	blink_timer.data = PANIC_FREQ;
> -	blink_timeout(PANIC_FREQ);
> +	blink_timer_timeout = PANIC_FREQ;
> +	blink_timeout(0);
>  
>  	return NOTIFY_DONE;
>  }
> @@ -142,8 +143,7 @@ static __init int ip32_reboot_setup(void)
>  	_machine_halt = ip32_machine_halt;
>  	pm_power_off = ip32_machine_halt;
>  
> -	init_timer(&blink_timer);
> -	blink_timer.function = blink_timeout;
> +	setup_timer(&blink_timer, blink_timeout, 0);
>  	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>  
>  	return 0;

  Ralf

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

* Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer
  2017-09-01  6:59   ` Ralf Baechle
@ 2017-09-01 16:57     ` Kees Cook
  0 siblings, 0 replies; 7+ messages in thread
From: Kees Cook @ 2017-09-01 16:57 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Thomas Gleixner, James Hogan, Ingo Molnar, Paul Gortmaker,
	Linux MIPS Mailing List, LKML

On Thu, Aug 31, 2017 at 11:59 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Thu, Aug 31, 2017 at 04:29:36PM -0700, Kees Cook wrote:
>
>> In preparation for changing the timer callback argument to the timer
>> pointer, move to a separate static data variable.
>>
>> Cc: Ralf Baechle <ralf@linux-mips.org>
>> Cc: James Hogan <james.hogan@imgtec.com>
>> Cc: Ingo Molnar <mingo@kernel.org>
>> Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
>> Cc: linux-mips@linux-mips.org
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>>  arch/mips/sgi-ip22/ip22-reset.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
>> index 196b041866ac..5cc32610e6d3 100644
>> --- a/arch/mips/sgi-ip22/ip22-reset.c
>> +++ b/arch/mips/sgi-ip22/ip22-reset.c
>> @@ -38,6 +38,7 @@
>>  #define PANIC_FREQ           (HZ / 8)
>>
>>  static struct timer_list power_timer, blink_timer, debounce_timer;
>> +static unsigned long blink_timer_timeout;
>
> You're removing power_timer and debounce_timer ...

Nope, I think you misread: this only adds blink_timer_timeout;

>
>>  #define MACHINE_PANICED              1
>>  #define MACHINE_SHUTTING_DOWN        2
>> @@ -86,13 +87,13 @@ static void power_timeout(unsigned long data)
>>       sgi_machine_power_off();
>>  }
>>
>> -static void blink_timeout(unsigned long data)
>> +static void blink_timeout(unsigned long unused)
>>  {
>>       /* XXX fix this for fullhouse  */
>>       sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
>>       sgioc->reset = sgi_ioc_reset;
>>
>> -     mod_timer(&blink_timer, jiffies + data);
>> +     mod_timer(&blink_timer, jiffies + blink_timer_timeout);
>>  }
>>
>>  static void debounce(unsigned long data)
>> @@ -128,8 +129,8 @@ static inline void power_button(void)
>>       }
>>
>>       machine_state |= MACHINE_SHUTTING_DOWN;
>> -     blink_timer.data = POWERDOWN_FREQ;
>> -     blink_timeout(POWERDOWN_FREQ);
>> +     blink_timer_timeout = POWERDOWN_FREQ;
>> +     blink_timeout(0);
>>
>>       setup_timer(&power_timer, power_timeout, 0UL);
>
> ... but don't remove the reference to power_timer nor use of debounce_timer.
>
>>       power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
>> @@ -169,8 +170,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
>>               return NOTIFY_DONE;
>>       machine_state |= MACHINE_PANICED;
>>
>> -     blink_timer.data = PANIC_FREQ;
>> -     blink_timeout(PANIC_FREQ);
>> +     blink_timer_timeout = PANIC_FREQ;
>> +     blink_timeout(0);
>>
>>       return NOTIFY_DONE;
>>  }
>> @@ -193,8 +194,7 @@ static int __init reboot_setup(void)
>>               return res;
>>       }
>>
>> -     init_timer(&blink_timer);
>> -     blink_timer.function = blink_timeout;
>> +     setup_timer(&blink_timer, blink_timeout, 0);
>>       atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
>>
>>       return 0;
>
>   Ralf

-Kees


-- 
Kees Cook
Pixel Security

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

* Re: [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer
  2017-08-31 23:29 ` [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer Kees Cook
  2017-09-01  7:04   ` Ralf Baechle
@ 2017-09-01 22:56   ` Ralf Baechle
  1 sibling, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2017-09-01 22:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Ingo Molnar, Arnd Bergmann, linux-mips,
	linux-kernel

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

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

* Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer
  2017-08-31 23:29 ` [PATCH 24/31] mips/sgi-ip22: " Kees Cook
  2017-09-01  6:59   ` Ralf Baechle
@ 2017-09-01 22:56   ` Ralf Baechle
  1 sibling, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2017-09-01 22:56 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, James Hogan, Ingo Molnar, Paul Gortmaker,
	linux-mips, linux-kernel

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

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

end of thread, other threads:[~2017-09-01 22:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1504222183-61202-1-git-send-email-keescook@chromium.org>
2017-08-31 23:29 ` [PATCH 23/31] mips/sgi-ip32: Use separate static data field with with static timer Kees Cook
2017-09-01  7:04   ` Ralf Baechle
2017-09-01 22:56   ` Ralf Baechle
2017-08-31 23:29 ` [PATCH 24/31] mips/sgi-ip22: " Kees Cook
2017-09-01  6:59   ` Ralf Baechle
2017-09-01 16:57     ` Kees Cook
2017-09-01 22:56   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox