Re: [DRIVER][RFC] SC1200 Watchdog driver

Alan Cox
2002-02-21T13:24:54Z

> 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