diff options
Diffstat (limited to 'drivers/watchdog/geodewdt.c')
-rw-r--r-- | drivers/watchdog/geodewdt.c | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 04b861cfdf0c..614a5c7017b6 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
@@ -77,27 +77,24 @@ static int geodewdt_set_heartbeat(int val) | |||
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | static int | 80 | static int geodewdt_open(struct inode *inode, struct file *file) |
81 | geodewdt_open(struct inode *inode, struct file *file) | ||
82 | { | 81 | { |
83 | if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) | 82 | if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) |
84 | return -EBUSY; | 83 | return -EBUSY; |
85 | 84 | ||
86 | if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) | 85 | if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) |
87 | __module_get(THIS_MODULE); | 86 | __module_get(THIS_MODULE); |
88 | 87 | ||
89 | geodewdt_ping(); | 88 | geodewdt_ping(); |
90 | return nonseekable_open(inode, file); | 89 | return nonseekable_open(inode, file); |
91 | } | 90 | } |
92 | 91 | ||
93 | static int | 92 | static int geodewdt_release(struct inode *inode, struct file *file) |
94 | geodewdt_release(struct inode *inode, struct file *file) | ||
95 | { | 93 | { |
96 | if (safe_close) { | 94 | if (safe_close) { |
97 | geodewdt_disable(); | 95 | geodewdt_disable(); |
98 | module_put(THIS_MODULE); | 96 | module_put(THIS_MODULE); |
99 | } | 97 | } else { |
100 | else { | ||
101 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); | 98 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); |
102 | geodewdt_ping(); | 99 | geodewdt_ping(); |
103 | 100 | ||
@@ -109,11 +106,10 @@ geodewdt_release(struct inode *inode, struct file *file) | |||
109 | return 0; | 106 | return 0; |
110 | } | 107 | } |
111 | 108 | ||
112 | static ssize_t | 109 | static ssize_t geodewdt_write(struct file *file, const char __user *data, |
113 | geodewdt_write(struct file *file, const char __user *data, size_t len, | 110 | size_t len, loff_t *ppos) |
114 | loff_t *ppos) | ||
115 | { | 111 | { |
116 | if(len) { | 112 | if (len) { |
117 | if (!nowayout) { | 113 | if (!nowayout) { |
118 | size_t i; | 114 | size_t i; |
119 | safe_close = 0; | 115 | safe_close = 0; |
@@ -134,9 +130,8 @@ geodewdt_write(struct file *file, const char __user *data, size_t len, | |||
134 | return len; | 130 | return len; |
135 | } | 131 | } |
136 | 132 | ||
137 | static int | 133 | static int geodewdt_ioctl(struct inode *inode, struct file *file, |
138 | geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 134 | unsigned int cmd, unsigned long arg) |
139 | unsigned long arg) | ||
140 | { | 135 | { |
141 | void __user *argp = (void __user *)arg; | 136 | void __user *argp = (void __user *)arg; |
142 | int __user *p = argp; | 137 | int __user *p = argp; |
@@ -147,7 +142,7 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
147 | | WDIOF_MAGICCLOSE, | 142 | | WDIOF_MAGICCLOSE, |
148 | .firmware_version = 1, | 143 | .firmware_version = 1, |
149 | .identity = WATCHDOG_NAME, | 144 | .identity = WATCHDOG_NAME, |
150 | }; | 145 | }; |
151 | 146 | ||
152 | switch (cmd) { | 147 | switch (cmd) { |
153 | case WDIOC_GETSUPPORT: | 148 | case WDIOC_GETSUPPORT: |
@@ -200,22 +195,21 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
200 | } | 195 | } |
201 | 196 | ||
202 | static const struct file_operations geodewdt_fops = { | 197 | static const struct file_operations geodewdt_fops = { |
203 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
204 | .llseek = no_llseek, | 199 | .llseek = no_llseek, |
205 | .write = geodewdt_write, | 200 | .write = geodewdt_write, |
206 | .ioctl = geodewdt_ioctl, | 201 | .ioctl = geodewdt_ioctl, |
207 | .open = geodewdt_open, | 202 | .open = geodewdt_open, |
208 | .release = geodewdt_release, | 203 | .release = geodewdt_release, |
209 | }; | 204 | }; |
210 | 205 | ||
211 | static struct miscdevice geodewdt_miscdev = { | 206 | static struct miscdevice geodewdt_miscdev = { |
212 | .minor = WATCHDOG_MINOR, | 207 | .minor = WATCHDOG_MINOR, |
213 | .name = "watchdog", | 208 | .name = "watchdog", |
214 | .fops = &geodewdt_fops | 209 | .fops = &geodewdt_fops, |
215 | }; | 210 | }; |
216 | 211 | ||
217 | static int __devinit | 212 | static int __devinit geodewdt_probe(struct platform_device *dev) |
218 | geodewdt_probe(struct platform_device *dev) | ||
219 | { | 213 | { |
220 | int ret, timer; | 214 | int ret, timer; |
221 | 215 | ||
@@ -246,15 +240,13 @@ geodewdt_probe(struct platform_device *dev) | |||
246 | return ret; | 240 | return ret; |
247 | } | 241 | } |
248 | 242 | ||
249 | static int __devexit | 243 | static int __devexit geodewdt_remove(struct platform_device *dev) |
250 | geodewdt_remove(struct platform_device *dev) | ||
251 | { | 244 | { |
252 | misc_deregister(&geodewdt_miscdev); | 245 | misc_deregister(&geodewdt_miscdev); |
253 | return 0; | 246 | return 0; |
254 | } | 247 | } |
255 | 248 | ||
256 | static void | 249 | static void geodewdt_shutdown(struct platform_device *dev) |
257 | geodewdt_shutdown(struct platform_device *dev) | ||
258 | { | 250 | { |
259 | geodewdt_disable(); | 251 | geodewdt_disable(); |
260 | } | 252 | } |
@@ -269,8 +261,7 @@ static struct platform_driver geodewdt_driver = { | |||
269 | }, | 261 | }, |
270 | }; | 262 | }; |
271 | 263 | ||
272 | static int __init | 264 | static int __init geodewdt_init(void) |
273 | geodewdt_init(void) | ||
274 | { | 265 | { |
275 | int ret; | 266 | int ret; |
276 | 267 | ||
@@ -290,8 +281,7 @@ err: | |||
290 | return ret; | 281 | return ret; |
291 | } | 282 | } |
292 | 283 | ||
293 | static void __exit | 284 | static void __exit geodewdt_exit(void) |
294 | geodewdt_exit(void) | ||
295 | { | 285 | { |
296 | platform_device_unregister(geodewdt_platform_device); | 286 | platform_device_unregister(geodewdt_platform_device); |
297 | platform_driver_unregister(&geodewdt_driver); | 287 | platform_driver_unregister(&geodewdt_driver); |