Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388AbdIAQ5f (ORCPT ); Fri, 1 Sep 2017 12:57:35 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:32860 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbdIAQ5d (ORCPT ); Fri, 1 Sep 2017 12:57:33 -0400 X-Google-Smtp-Source: ADKCNb6f/5cP0PuuJ16f+mRu6IaVXiFlaw5k4b/Ga21mIL3uRU5BnXbtVaLlDmXFDDtSWKAssJlrsVYNjgz6jNMDHKA= MIME-Version: 1.0 In-Reply-To: <20170901065947.GA32117@linux-mips.org> References: <1504222183-61202-1-git-send-email-keescook@chromium.org> <1504222183-61202-25-git-send-email-keescook@chromium.org> <20170901065947.GA32117@linux-mips.org> From: Kees Cook Date: Fri, 1 Sep 2017 09:57:32 -0700 X-Google-Sender-Auth: bW8Cl7R_XCNf9JFCRW9H7iiAwAk Message-ID: Subject: Re: [PATCH 24/31] mips/sgi-ip22: Use separate static data field with with static timer To: Ralf Baechle Cc: Thomas Gleixner , James Hogan , Ingo Molnar , Paul Gortmaker , Linux MIPS Mailing List , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3027 Lines: 93 On Thu, Aug 31, 2017 at 11:59 PM, Ralf Baechle 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 >> Cc: James Hogan >> Cc: Ingo Molnar >> Cc: Paul Gortmaker >> Cc: linux-mips@linux-mips.org >> Signed-off-by: Kees Cook >> --- >> 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