Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [WATCHDOG] bfin: fix max timeout calculation
This commit is contained in:
Linus Torvalds 2010-02-21 11:25:47 -08:00
commit d13536bef4
1 changed files with 7 additions and 6 deletions

View File

@ -1,9 +1,8 @@
/* /*
* Blackfin On-Chip Watchdog Driver * Blackfin On-Chip Watchdog Driver
* Supports BF53[123]/BF53[467]/BF54[2489]/BF561
* *
* Originally based on softdog.c * Originally based on softdog.c
* Copyright 2006-2007 Analog Devices Inc. * Copyright 2006-2010 Analog Devices Inc.
* Copyright 2006-2007 Michele d'Amico * Copyright 2006-2007 Michele d'Amico
* Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk> * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
* *
@ -137,13 +136,15 @@ static int bfin_wdt_running(void)
*/ */
static int bfin_wdt_set_timeout(unsigned long t) static int bfin_wdt_set_timeout(unsigned long t)
{ {
u32 cnt; u32 cnt, max_t, sclk;
unsigned long flags; unsigned long flags;
stampit(); sclk = get_sclk();
max_t = -1 / sclk;
cnt = t * sclk;
stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt);
cnt = t * get_sclk(); if (t > max_t) {
if (cnt < get_sclk()) {
printk(KERN_WARNING PFX "timeout value is too large\n"); printk(KERN_WARNING PFX "timeout value is too large\n");
return -EINVAL; return -EINVAL;
} }