6 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8 #include <linux/kernel.h>
9 #include <linux/module.h>
10 #include <linux/types.h>
12 #include <linux/errno.h>
15 #include <linux/watchdog.h>
20 #include <linux/slab.h>
52 #define DRIVER_NAME "riowd"
53 #define PFX DRIVER_NAME ": "
60 static struct riowd *riowd_device;
62 #define WDTO_INDEX 0x05
64 static int riowd_timeout = 1;
75 spin_unlock_irqrestore(&p->
lock, flags);
89 static long riowd_ioctl(
struct file *filp,
unsigned int cmd,
unsigned long arg)
93 .firmware_version = 1,
97 struct riowd *
p = riowd_device;
109 if (
put_user(0, (
int __user *)argp))
131 if (
get_user(new_margin, (
int __user *)argp))
133 if ((new_margin < 60) || (new_margin > (255 * 60)))
135 riowd_timeout = (new_margin + 59) / 60;
140 return put_user(riowd_timeout * 60, (
int __user *)argp);
150 size_t count, loff_t *ppos)
152 struct riowd *p = riowd_device;
165 .unlocked_ioctl = riowd_ioctl,
167 .write = riowd_write,
168 .release = riowd_release,
194 pr_err(
"Cannot map registers\n");
202 pr_err(
"Cannot register watchdog misc device\n");
206 pr_info(
"Hardware watchdog [%i minutes], regs at %p\n",
207 riowd_timeout, p->
regs);
246 .of_match_table = riowd_match,
248 .probe = riowd_probe,