lkml.org 
[lkml]   [2011]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] watchdog: add real function on MOXA V2100 watchdog driver
> +	superio_set_logic_device(7);    /* logic device 7 */
> + superio_set_reg((swtd_ack_time/1000), 0x73); /* Reg:F6,30 sec */
> +}

If the time is configurable then you want to support that ideally.

> +static void swtd_reboot(void *unused)

No - the watchdog driver needs to deal with hardware reboot, randomly
trying to exec things which may not even be where you expect isn't safe.
User space watchdog daemons can manage their own shutdown just fine. The
watchdog is there to catch the actual hang case.


> + superio_set_reg(1000/1000, 0x73);
> +
> + return NOTIFY_OK;
> +
> + spin_unlock_bh(&swtd_lock);

Wrong order - your lock is left locked !


> +static struct miscdevice wdt_miscdev = {
> + .minor = MOXA_WATCHDOG_MINOR,
> + .name = "swtd",
> + .fops = &moxa_swtd_fops,
> +};

This should use the standard watchdog device


> +moxa_swtd_init_err3:
> + remove_proc_entry("driver/swtd", NULL);
> +moxa_swtd_init_err2:
> + if (timer_pending(&timer_swtd))
> + del_timer(&timer_swtd);

del_timer_sync to ensure it has run

You also need to sort out locking.

There is also no test to ensure the hardware is present so the driver
isn't safe to load on any PC hardware

Is there a magic signature to detect the hardware ?

Alan


\
 
 \ /
  Last update: 2011-04-26 12:53    [W:0.082 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site