Re: [RFC, PATCH] watchdog on gpio

Alan Cox
2008-01-14T09:06:27Z

> > #include <linux/gpio_wdt.h>
>
> perhaps "watchdog" rather than "wdt" considering it's already
> "linux/watchdog.h" ?

or _wdt/wdt_ like the rest of the watchdog code uses for watchdog names
(wdt ->watchdog timer).

>
> > + case WDIOC_KEEPALIVE:
> > + gpio_wdt_keepalive(wdt);
> > + return 0;
>
> this two lines should be merged.

No.

> > + default:
> > + return -ENOIOCTLCMD;
>
> should be -ENOTTY like all the other watchdogs

Yes. That's a common confusion. -ENOIOCTLCMD is a magic code used
internally by some mid layers to indicate the driver doesn't know the
ioctl so use default behaviour. -ENOTTY (confusingly but this is Unix
history) is the right answer for unknowns.
>
> > +static char banner[] __initdata = KERN_INFO PFX "fixed %d.%03d seconds timeout (nowayout= %d)\n";
>
> this only gets used once in the init function ... having it be broken
> out like this is kind of silly

Saves memory - you can't make inlined strings __initdata without breaking
some compilers. So it is correct.

>
> > +static int __init gpio_wdt_probe(struct platform_device *pdev)
>
> shouldnt this be __devinit ?

IFF the device can be found/removed dynamically.

> > + if (watchdog) {
> > + printk(KERN_ERR PFX "only one device supported\n");
> > + return -ENODEV;
> > + }
>
> why ? it'd be trivial to abstract this driver away from a global
> "watchdog" state into a proper arbitrary # of gpio watchdogs.

The core watchdog code only supports one watchdog currently. This again
is correct.