[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Sep 2006 01:49:41 +0400
From: Alexey Dobriyan <adobriyan@...il.com>
To: Samuel Tardieu <sam@...1149.net>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>, linux-kernel@...r.kernel.org,
Pádraig Brady <P@...igBrady.com>,
Wim Van Sebroeck <wim@...ana.be>
Subject: Re: [PATCH] watchdog: add support for w83697hg chip
On Sat, Sep 09, 2006 at 06:28:44PM +0200, Samuel Tardieu wrote:
> --- /dev/null
> +++ b/drivers/char/watchdog/w83697hf_wdt.c
> +#define W83697HF_EFER (wdt_io+0) /* Extended function enable register */
> +#define W83697HF_EFIR (wdt_io+0) /* Extended function index register */
> +#define W83697HF_EFDR (wdt_io+1) /* Extended function data register */
Perhaps REG_ENABLE, REG_IDX, REG_DATA (with common short prefix) so
you won't refer to comments every time to understant meaning?
> +static inline void
> +w83697hf_unlock(void)
Make it on one line:
static inline void w83697hf_unlock(void)
Ditto for all such short lines.
> +static int
> +w83697hf_init(void)
Can be __init?
> +{
> + if (!request_region(wdt_io, 2, WATCHDOG_NAME)) {
> + printk(KERN_ERR PFX "I/O address 0x%x already in use\n", wdt_io);
> + return -EIO;
> + }
> +
> + printk(KERN_DEBUG PFX "Looking for watchdog at address 0x%x\n", wdt_io);
> + w83697hf_unlock();
> + if (w83697hf_get_reg(0x20) == 0x60) {
> + printk(KERN_INFO PFX "watchdog found at address 0x%x\n", wdt_io);
> + w83697hf_lock();
> + return 0;
> + }
> + w83697hf_lock(); /* Reprotect in case it was a compatible device */
> +
> + printk(KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io);
KERN_ERR probably.
> + release_region(wdt_io, 2);
> + return -EIO;
> +}
Generally errorless codepath is kept straight and error codepaths branch
from it. I don't remember if this in CodingStyle, so feel free to
ignore. ;-) Something like that:
if (w83697hf_get_reg(0x20) != 0x60) {
w83697hf_lock(); /* Reprotect in case it was a compatible device */
...
return
}
printk(KERN_INFO PFX "watchdog found at address 0x%x\n", wdt_io);
...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists