Re: [PATCH] watchdog: add support for w83697hg chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux