On Thu, Oct 5, 2017 at 1:26 AM, Kees Cook <keesc...@chromium.org> wrote:
> Remove uses of init_timer_on_stack() with open-coded function and data
> assignments that could be expressed using timer_setup_on_stack(). Several
> were removed from the stack entirely since there was a one-to-one mapping
> of parent structure to timer, those are switched to using timer_setup()
> instead. All related callbacks were adjusted to use from_timer().
>
> Cc: "Rafael J. Wysocki" <r...@rjwysocki.net>
> Cc: Pavel Machek <pa...@ucw.cz>
> Cc: Len Brown <len.br...@intel.com>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Stefan Richter <stef...@s5r6.in-berlin.de>
> Cc: Sudip Mukherjee <sudipm.mukher...@gmail.com>
> Cc: Martin Schwidefsky <schwidef...@de.ibm.com>
> Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
> Cc: Julian Wiedmann <j...@linux.vnet.ibm.com>
> Cc: Ursula Braun <ubr...@linux.vnet.ibm.com>
> Cc: Michael Reed <m...@sgi.com>
> Cc: "James E.J. Bottomley" <j...@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.peter...@oracle.com>
> Cc: Thomas Gleixner <t...@linutronix.de>
> Cc: linux...@vger.kernel.org
> Cc: linux1394-de...@lists.sourceforge.net
> Cc: linux-s...@vger.kernel.org
> Cc: linux-s...@vger.kernel.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>
> ---
>  drivers/base/power/main.c           |  8 +++-----
>  drivers/firewire/core-transaction.c | 10 +++++-----
>  drivers/parport/ieee1284.c          | 21 +++++++--------------
>  drivers/s390/char/tape.h            |  1 +
>  drivers/s390/char/tape_std.c        | 18 ++++++------------
>  drivers/s390/net/lcs.c              | 16 ++++++----------
>  drivers/s390/net/lcs.h              |  1 +
>  drivers/scsi/qla1280.c              | 14 +++++---------
>  drivers/scsi/qla1280.h              |  1 +
>  include/linux/parport.h             |  1 +
>  include/linux/timer.h               |  2 --
>  11 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 770b1539a083..ae47b2ec84b4 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -478,9 +478,9 @@ struct dpm_watchdog {
>   * There's not much we can do here to recover so panic() to
>   * capture a crash-dump in pstore.
>   */
> -static void dpm_watchdog_handler(unsigned long data)
> +static void dpm_watchdog_handler(struct timer_list *t)
>  {
> -       struct dpm_watchdog *wd = (void *)data;
> +       struct dpm_watchdog *wd = from_timer(wd, t, timer);
>
>         dev_emerg(wd->dev, "**** DPM device timeout ****\n");
>         show_stack(wd->tsk, NULL);
> @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, 
> struct device *dev)
>         wd->dev = dev;
>         wd->tsk = current;
>
> -       init_timer_on_stack(timer);
> +       timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
>         /* use same timeout value for both suspend and resume */
>         timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
> -       timer->function = dpm_watchdog_handler;
> -       timer->data = (unsigned long)wd;
>         add_timer(timer);
>  }

For the above:

Acked-by: Rafael J. Wysocki <rafael.j.wyso...@intel.com>

Reply via email to