Re: [PATCHv3 7/11] WDT: Watchdog timer module of DA9052 devicedriver

From: Wim Van Sebroeck
Date: Wed Jan 26 2011 - 16:14:09 EST


Hi,

> +static long da9052_wdt_ioctl(struct file *file, unsigned int cmd,
> + unsigned long arg)
> +{
> + struct da9052_wdt *wdt = get_wdt_da9052();
> + void __user *argp = (void __user *)arg;
> + int __user *p = argp;
> + unsigned char new_value;
> +
> + switch (cmd) {
> +
> + case WDIOC_GETSUPPORT:
> + return copy_to_user(argp, &da9052_wdt_info,
> + sizeof(da9052_wdt_info)) ? -EFAULT : 0;
> + case WDIOC_GETSTATUS:
> + case WDIOC_GETBOOTSTATUS:
> + return put_user(0, p);
> + case WDIOC_SETOPTIONS:
> + if (get_user(new_value, p))
> + return -EFAULT;
> + if (new_value & DA9052_STROBING_FILTER_ENABLE)
> + da9052_sm_set_strobing_filter(wdt, ENABLE);
> + if (new_value & DA9052_STROBING_FILTER_DISABLE)
> + da9052_sm_set_strobing_filter(wdt, DISABLE);
> + if (new_value & DA9052_SET_STROBING_MODE_MANUAL)
> + da9052_sm_set_strobing_mode(DA9052_STROBE_MANUAL);
> + if (new_value & DA9052_SET_STROBING_MODE_AUTO)
> + da9052_sm_set_strobing_mode(DA9052_STROBE_AUTO);
> + return 0;

The ioctl WDIOC_SETOPTIONS call is not in line with the watchdog API.
the supported options are:
#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */
#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */

Your options are:
#define DA9052_STROBING_FILTER_ENABLE 0x0001
#define DA9052_STROBING_FILTER_DISABLE 0x0002
#define DA9052_SET_STROBING_MODE_MANUAL 0x0004
#define DA9052_SET_STROBING_MODE_AUTO 0x0008

Please explain what you want to do.

Thanks in advance,
Wim.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/