aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/geodewdt.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2008-08-06 16:19:41 -0400
committerWim Van Sebroeck <wim@iguana.be>2008-08-06 16:19:41 -0400
commit7944d3a5a70ee5c1904ed1e8b1d71ff0af2854d9 (patch)
treefe6ec1a557a4b27712266d9d86f791c69e8e2596 /drivers/watchdog/geodewdt.c
parent12b7a1523eda9cd72362fdda928ddb995ecdc06d (diff)
[WATCHDOG] more coding style clean-up's
More coding style clean-up's. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/geodewdt.c')
-rw-r--r--drivers/watchdog/geodewdt.c62
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
80static int 80static int geodewdt_open(struct inode *inode, struct file *file)
81geodewdt_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
93static int 92static int geodewdt_release(struct inode *inode, struct file *file)
94geodewdt_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
112static ssize_t 109static ssize_t geodewdt_write(struct file *file, const char __user *data,
113geodewdt_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
137static int 133static int geodewdt_ioctl(struct inode *inode, struct file *file,
138geodewdt_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
202static const struct file_operations geodewdt_fops = { 197static 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
211static struct miscdevice geodewdt_miscdev = { 206static 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
217static int __devinit 212static int __devinit geodewdt_probe(struct platform_device *dev)
218geodewdt_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
249static int __devexit 243static int __devexit geodewdt_remove(struct platform_device *dev)
250geodewdt_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
256static void 249static void geodewdt_shutdown(struct platform_device *dev)
257geodewdt_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
272static int __init 264static int __init geodewdt_init(void)
273geodewdt_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
293static void __exit 284static void __exit geodewdt_exit(void)
294geodewdt_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);