lkml.org 
[lkml]   [2002]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] [2.4.20-pre1] Watchdog Stuff (1/4)
            Here are four patches for the watchdog drivers.  These patches
    are an update to 2.4.20-pre1 of the original set against 2.4.19-pre9.
    The first patch (this one) adds WDIOC_SETTIMEOUT support to
    wafer5823wdt.c. The second patch adds Matt Domsch's 'nowayout' module
    option to the drivers that currently don't have it. The third patch
    fixes a bug where most of the "magic close character" capable drivers
    don't use get_user(). The fourth patch adds "magic close character"
    support to almost all of the remaining drivers. It also adds
    WDIOF_MAGICCLOSE to the driver info flags.

    Joel

    diff -uNr linux-2.4.20-pre1/drivers/char/wafer5823wdt.c linux-2.4.20-pre1-settimeout/drivers/char/wafer5823wdt.c
    --- linux-2.4.20-pre1/drivers/char/wafer5823wdt.c Fri Aug 2 17:39:43 2002
    +++ linux-2.4.20-pre1-settimeout/drivers/char/wafer5823wdt.c Wed Aug 7 15:24:03 2002
    @@ -54,6 +54,7 @@
    #define WDT_STOP 0x843

    #define WD_TIMO 60 /* 1 minute */
    +static int wd_margin = WD_TIMO;

    static void wafwdt_ping(void)
    {
    @@ -67,7 +68,7 @@
    static void wafwdt_start(void)
    {
    /* start up watchdog */
    - outb_p(WD_TIMO, WDT_START);
    + outb_p(wd_margin, WDT_START);
    inb_p(WDT_START);
    }

    @@ -94,8 +95,10 @@
    static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
    unsigned long arg)
    {
    + int new_margin;
    static struct watchdog_info ident = {
    - WDIOF_KEEPALIVEPING, 1, "Wafer 5823 WDT"
    + WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
    + 1, "Wafer 5823 WDT"
    };
    int one=1;

    @@ -114,6 +117,18 @@
    case WDIOC_KEEPALIVE:
    wafwdt_ping();
    break;
    +
    + case WDIOC_SETTIMEOUT:
    + if (get_user(new_margin, (int *)arg))
    + return -EFAULT;
    + if ((new_margin < 1) || (new_margin > 255))
    + return -EINVAL;
    + wd_margin = new_margin;
    + wafwdt_stop();
    + wafwdt_start();
    + /* Fall */
    + case WDIOC_GETTIMEOUT:
    + return put_user(wd_margin, (int *)arg);

    default:
    return -ENOTTY;
    --

    "What do you take me for, an idiot?"
    - General Charles de Gaulle, when a journalist asked him
    if he was happy.
    Joel Becker
    Senior Member of Technical Staff
    Oracle Corporation
    E-mail: joel.becker@oracle.com
    Phone: (650) 506-8127
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:27    [W:0.025 / U:128.484 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site