Re: [DRIVER][RFC] SC1200 Watchdog driver

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Thu Feb 21 2002 - 08:37:40 EST


> Put the GETTIMEOUT stuff in an ioctl, heres my current version, it
> implements a number of the ioctls as well as the reboot notifier and
> semaphores for locking.

Aside from the other comments Jeff made its got one bug that I only noticed
because I fixed it in a pile of other stuff 8)

> /* Write to Data Register */
> static inline void sc1200wdt_write_data(unsigned char index, unsigned char data)
> {
> outb_p(index, PMIR);
> outb(data, PMDR);
> }

two instruction sequence

> case WDIOC_KEEPALIVE:
> sc1200wdt_write_data(WDTO, timeout);
> return 0;

open
fork
ioctl from two processes one per cpu at the same time

> static int sc1200wdt_release(struct inode *inode, struct file *file)
> {
> /* Disable it on the way out */
> sc1200wdt_write_data(WDTO, 0);
> up(&open_sem);

NOWAYOUT support is missing - trivial to fix. Just remember to MOD_INC_USE..
on the nowayout path

> static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
> {
> if (code == SYS_DOWN || code == SYS_HALT)
> sc1200wdt_write_data(WDTO, 0);

Ditto on the nowayout

Alan in pedantic mode

-
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/



This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:32 EST