diff options
Diffstat (limited to 'drivers/watchdog/sa1100_wdt.c')
-rw-r--r-- | drivers/watchdog/sa1100_wdt.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index 97d9da758dcc..31a48437dc3d 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/watchdog.h> | 26 | #include <linux/watchdog.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/uaccess.h> | ||
29 | 30 | ||
30 | #ifdef CONFIG_ARCH_PXA | 31 | #ifdef CONFIG_ARCH_PXA |
31 | #include <mach/pxa-regs.h> | 32 | #include <mach/pxa-regs.h> |
@@ -33,7 +34,6 @@ | |||
33 | 34 | ||
34 | #include <mach/reset.h> | 35 | #include <mach/reset.h> |
35 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
36 | #include <asm/uaccess.h> | ||
37 | 37 | ||
38 | #define OSCR_FREQ CLOCK_TICK_RATE | 38 | #define OSCR_FREQ CLOCK_TICK_RATE |
39 | 39 | ||
@@ -46,7 +46,7 @@ static int boot_status; | |||
46 | */ | 46 | */ |
47 | static int sa1100dog_open(struct inode *inode, struct file *file) | 47 | static int sa1100dog_open(struct inode *inode, struct file *file) |
48 | { | 48 | { |
49 | if (test_and_set_bit(1,&sa1100wdt_users)) | 49 | if (test_and_set_bit(1, &sa1100wdt_users)) |
50 | return -EBUSY; | 50 | return -EBUSY; |
51 | 51 | ||
52 | /* Activate SA1100 Watchdog timer */ | 52 | /* Activate SA1100 Watchdog timer */ |
@@ -67,28 +67,27 @@ static int sa1100dog_open(struct inode *inode, struct file *file) | |||
67 | static int sa1100dog_release(struct inode *inode, struct file *file) | 67 | static int sa1100dog_release(struct inode *inode, struct file *file) |
68 | { | 68 | { |
69 | printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n"); | 69 | printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n"); |
70 | |||
71 | clear_bit(1, &sa1100wdt_users); | 70 | clear_bit(1, &sa1100wdt_users); |
72 | |||
73 | return 0; | 71 | return 0; |
74 | } | 72 | } |
75 | 73 | ||
76 | static ssize_t sa1100dog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) | 74 | static ssize_t sa1100dog_write(struct file *file, const char __user *data, |
75 | size_t len, loff_t *ppos) | ||
77 | { | 76 | { |
78 | if (len) | 77 | if (len) |
79 | /* Refresh OSMR3 timer. */ | 78 | /* Refresh OSMR3 timer. */ |
80 | OSMR3 = OSCR + pre_margin; | 79 | OSMR3 = OSCR + pre_margin; |
81 | |||
82 | return len; | 80 | return len; |
83 | } | 81 | } |
84 | 82 | ||
85 | static struct watchdog_info ident = { | 83 | static const struct watchdog_info ident = { |
86 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
85 | | WDIOF_KEEPALIVEPING, | ||
87 | .identity = "SA1100/PXA255 Watchdog", | 86 | .identity = "SA1100/PXA255 Watchdog", |
88 | }; | 87 | }; |
89 | 88 | ||
90 | static int sa1100dog_ioctl(struct inode *inode, struct file *file, | 89 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, |
91 | unsigned int cmd, unsigned long arg) | 90 | unsigned long arg) |
92 | { | 91 | { |
93 | int ret = -ENOTTY; | 92 | int ret = -ENOTTY; |
94 | int time; | 93 | int time; |
@@ -109,6 +108,11 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
109 | ret = put_user(boot_status, p); | 108 | ret = put_user(boot_status, p); |
110 | break; | 109 | break; |
111 | 110 | ||
111 | case WDIOC_KEEPALIVE: | ||
112 | OSMR3 = OSCR + pre_margin; | ||
113 | ret = 0; | ||
114 | break; | ||
115 | |||
112 | case WDIOC_SETTIMEOUT: | 116 | case WDIOC_SETTIMEOUT: |
113 | ret = get_user(time, p); | 117 | ret = get_user(time, p); |
114 | if (ret) | 118 | if (ret) |
@@ -126,27 +130,20 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
126 | case WDIOC_GETTIMEOUT: | 130 | case WDIOC_GETTIMEOUT: |
127 | ret = put_user(pre_margin / OSCR_FREQ, p); | 131 | ret = put_user(pre_margin / OSCR_FREQ, p); |
128 | break; | 132 | break; |
129 | |||
130 | case WDIOC_KEEPALIVE: | ||
131 | OSMR3 = OSCR + pre_margin; | ||
132 | ret = 0; | ||
133 | break; | ||
134 | } | 133 | } |
135 | return ret; | 134 | return ret; |
136 | } | 135 | } |
137 | 136 | ||
138 | static const struct file_operations sa1100dog_fops = | 137 | static const struct file_operations sa1100dog_fops = { |
139 | { | ||
140 | .owner = THIS_MODULE, | 138 | .owner = THIS_MODULE, |
141 | .llseek = no_llseek, | 139 | .llseek = no_llseek, |
142 | .write = sa1100dog_write, | 140 | .write = sa1100dog_write, |
143 | .ioctl = sa1100dog_ioctl, | 141 | .unlocked_ioctl = sa1100dog_ioctl, |
144 | .open = sa1100dog_open, | 142 | .open = sa1100dog_open, |
145 | .release = sa1100dog_release, | 143 | .release = sa1100dog_release, |
146 | }; | 144 | }; |
147 | 145 | ||
148 | static struct miscdevice sa1100dog_miscdev = | 146 | static struct miscdevice sa1100dog_miscdev = { |
149 | { | ||
150 | .minor = WATCHDOG_MINOR, | 147 | .minor = WATCHDOG_MINOR, |
151 | .name = "watchdog", | 148 | .name = "watchdog", |
152 | .fops = &sa1100dog_fops, | 149 | .fops = &sa1100dog_fops, |
@@ -169,8 +166,9 @@ static int __init sa1100dog_init(void) | |||
169 | 166 | ||
170 | ret = misc_register(&sa1100dog_miscdev); | 167 | ret = misc_register(&sa1100dog_miscdev); |
171 | if (ret == 0) | 168 | if (ret == 0) |
172 | printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", | 169 | printk(KERN_INFO |
173 | margin); | 170 | "SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", |
171 | margin); | ||
174 | return ret; | 172 | return ret; |
175 | } | 173 | } |
176 | 174 | ||