aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2006-01-03 02:18:01 -0500
committerDave Airlie <airlied@linux.ie>2006-01-03 02:18:01 -0500
commit97f2aab6698f3ab2552c41c1024a65ffd0763a6d (patch)
treebb6e3b2949459f54f884c710fc74d40eef00d834 /drivers/char/watchdog
parentd985c1088146607532093d9eaaaf99758f6a4d21 (diff)
parent88026842b0a760145aa71d69e74fbc9ec118ca44 (diff)
drm: merge in Linus mainline
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r--drivers/char/watchdog/booke_wdt.c17
-rw-r--r--drivers/char/watchdog/mpcore_wdt.c34
-rw-r--r--drivers/char/watchdog/mv64x60_wdt.c20
-rw-r--r--drivers/char/watchdog/pcwd_pci.c1
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c30
-rw-r--r--drivers/char/watchdog/wdrtas.c2
-rw-r--r--drivers/char/watchdog/wdt_pci.c1
7 files changed, 50 insertions, 55 deletions
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index abc30cca6645..b6640606b44d 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -4,7 +4,7 @@
4 * Watchdog timer for PowerPC Book-E systems 4 * Watchdog timer for PowerPC Book-E systems
5 * 5 *
6 * Author: Matthew McClintock 6 * Author: Matthew McClintock
7 * Maintainer: Kumar Gala <kumar.gala@freescale.com> 7 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
8 * 8 *
9 * Copyright 2005 Freescale Semiconductor Inc. 9 * Copyright 2005 Freescale Semiconductor Inc.
10 * 10 *
@@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void)
72/* 72/*
73 * booke_wdt_write: 73 * booke_wdt_write:
74 */ 74 */
75static ssize_t booke_wdt_write (struct file *file, const char *buf, 75static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
76 size_t count, loff_t *ppos) 76 size_t count, loff_t *ppos)
77{ 77{
78 booke_wdt_ping(); 78 booke_wdt_ping();
@@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
92 unsigned int cmd, unsigned long arg) 92 unsigned int cmd, unsigned long arg)
93{ 93{
94 u32 tmp = 0; 94 u32 tmp = 0;
95 u32 __user *p = (u32 __user *)arg;
95 96
96 switch (cmd) { 97 switch (cmd) {
97 case WDIOC_GETSUPPORT: 98 case WDIOC_GETSUPPORT:
98 if (copy_to_user ((struct watchdog_info *) arg, &ident, 99 if (copy_to_user ((struct watchdog_info __user *) arg, &ident,
99 sizeof(struct watchdog_info))) 100 sizeof(struct watchdog_info)))
100 return -EFAULT; 101 return -EFAULT;
101 case WDIOC_GETSTATUS: 102 case WDIOC_GETSTATUS:
102 return put_user(ident.options, (u32 *) arg); 103 return put_user(ident.options, p);
103 case WDIOC_GETBOOTSTATUS: 104 case WDIOC_GETBOOTSTATUS:
104 /* XXX: something is clearing TSR */ 105 /* XXX: something is clearing TSR */
105 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 106 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
@@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
109 booke_wdt_ping(); 110 booke_wdt_ping();
110 return 0; 111 return 0;
111 case WDIOC_SETTIMEOUT: 112 case WDIOC_SETTIMEOUT:
112 if (get_user(booke_wdt_period, (u32 *) arg)) 113 if (get_user(booke_wdt_period, p))
113 return -EFAULT; 114 return -EFAULT;
114 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); 115 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
115 return 0; 116 return 0;
116 case WDIOC_GETTIMEOUT: 117 case WDIOC_GETTIMEOUT:
117 return put_user(booke_wdt_period, (u32 *) arg); 118 return put_user(booke_wdt_period, p);
118 case WDIOC_SETOPTIONS: 119 case WDIOC_SETOPTIONS:
119 if (get_user(tmp, (u32 *) arg)) 120 if (get_user(tmp, p))
120 return -EINVAL; 121 return -EINVAL;
121 if (tmp == WDIOS_ENABLECARD) { 122 if (tmp == WDIOS_ENABLECARD) {
122 booke_wdt_ping(); 123 booke_wdt_ping();
@@ -172,7 +173,7 @@ static int __init booke_wdt_init(void)
172 int ret = 0; 173 int ret = 0;
173 174
174 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); 175 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n");
175 ident.firmware_version = cpu_specs[0].pvr_value; 176 ident.firmware_version = cur_cpu_spec->pvr_value;
176 177
177 ret = misc_register(&booke_wdt_miscdev); 178 ret = misc_register(&booke_wdt_miscdev);
178 if (ret) { 179 if (ret) {
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c
index da631c114fd1..b4d843489881 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/char/watchdog/mpcore_wdt.c
@@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t)
139 */ 139 */
140static int mpcore_wdt_open(struct inode *inode, struct file *file) 140static int mpcore_wdt_open(struct inode *inode, struct file *file)
141{ 141{
142 struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); 142 struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev);
143 143
144 if (test_and_set_bit(0, &wdt->timer_alive)) 144 if (test_and_set_bit(0, &wdt->timer_alive))
145 return -EBUSY; 145 return -EBUSY;
@@ -180,10 +180,6 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data, size_t len,
180{ 180{
181 struct mpcore_wdt *wdt = file->private_data; 181 struct mpcore_wdt *wdt = file->private_data;
182 182
183 /* Can't seek (pwrite) on this device */
184 if (ppos != &file->f_pos)
185 return -ESPIPE;
186
187 /* 183 /*
188 * Refresh the timer. 184 * Refresh the timer.
189 */ 185 */
@@ -291,9 +287,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
291 * System shutdown handler. Turn off the watchdog if we're 287 * System shutdown handler. Turn off the watchdog if we're
292 * restarting or halting the system. 288 * restarting or halting the system.
293 */ 289 */
294static void mpcore_wdt_shutdown(struct device *_dev) 290static void mpcore_wdt_shutdown(struct platform_device *dev)
295{ 291{
296 struct mpcore_wdt *wdt = dev_get_drvdata(_dev); 292 struct mpcore_wdt *wdt = platform_get_drvdata(dev);
297 293
298 if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) 294 if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT)
299 mpcore_wdt_stop(wdt); 295 mpcore_wdt_stop(wdt);
@@ -317,9 +313,8 @@ static struct miscdevice mpcore_wdt_miscdev = {
317 .fops = &mpcore_wdt_fops, 313 .fops = &mpcore_wdt_fops,
318}; 314};
319 315
320static int __devinit mpcore_wdt_probe(struct device *_dev) 316static int __devinit mpcore_wdt_probe(struct platform_device *dev)
321{ 317{
322 struct platform_device *dev = to_platform_device(_dev);
323 struct mpcore_wdt *wdt; 318 struct mpcore_wdt *wdt;
324 struct resource *res; 319 struct resource *res;
325 int ret; 320 int ret;
@@ -364,7 +359,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
364 } 359 }
365 360
366 mpcore_wdt_stop(wdt); 361 mpcore_wdt_stop(wdt);
367 dev_set_drvdata(&dev->dev, wdt); 362 platform_set_drvdata(&dev->dev, wdt);
368 mpcore_wdt_dev = dev; 363 mpcore_wdt_dev = dev;
369 364
370 return 0; 365 return 0;
@@ -379,11 +374,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
379 return ret; 374 return ret;
380} 375}
381 376
382static int __devexit mpcore_wdt_remove(struct device *dev) 377static int __devexit mpcore_wdt_remove(struct platform_device *dev)
383{ 378{
384 struct mpcore_wdt *wdt = dev_get_drvdata(dev); 379 struct mpcore_wdt *wdt = platform_get_drvdata(dev);
385 380
386 dev_set_drvdata(dev, NULL); 381 platform_set_drvdata(dev, NULL);
387 382
388 misc_deregister(&mpcore_wdt_miscdev); 383 misc_deregister(&mpcore_wdt_miscdev);
389 384
@@ -395,13 +390,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev)
395 return 0; 390 return 0;
396} 391}
397 392
398static struct device_driver mpcore_wdt_driver = { 393static struct platform_driver mpcore_wdt_driver = {
399 .owner = THIS_MODULE,
400 .name = "mpcore_wdt",
401 .bus = &platform_bus_type,
402 .probe = mpcore_wdt_probe, 394 .probe = mpcore_wdt_probe,
403 .remove = __devexit_p(mpcore_wdt_remove), 395 .remove = __devexit_p(mpcore_wdt_remove),
404 .shutdown = mpcore_wdt_shutdown, 396 .shutdown = mpcore_wdt_shutdown,
397 .driver = {
398 .owner = THIS_MODULE,
399 .name = "mpcore_wdt",
400 },
405}; 401};
406 402
407static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; 403static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
@@ -420,12 +416,12 @@ static int __init mpcore_wdt_init(void)
420 416
421 printk(banner, mpcore_noboot, mpcore_margin, nowayout); 417 printk(banner, mpcore_noboot, mpcore_margin, nowayout);
422 418
423 return driver_register(&mpcore_wdt_driver); 419 return platform_driver_register(&mpcore_wdt_driver);
424} 420}
425 421
426static void __exit mpcore_wdt_exit(void) 422static void __exit mpcore_wdt_exit(void)
427{ 423{
428 driver_unregister(&mpcore_wdt_driver); 424 platform_driver_unregister(&mpcore_wdt_driver);
429} 425}
430 426
431module_init(mpcore_wdt_init); 427module_init(mpcore_wdt_init);
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index 119b3c541d95..00d9ef04a369 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -182,10 +182,9 @@ static struct miscdevice mv64x60_wdt_miscdev = {
182 .fops = &mv64x60_wdt_fops, 182 .fops = &mv64x60_wdt_fops,
183}; 183};
184 184
185static int __devinit mv64x60_wdt_probe(struct device *dev) 185static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
186{ 186{
187 struct platform_device *pd = to_platform_device(dev); 187 struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
188 struct mv64x60_wdt_pdata *pdata = pd->dev.platform_data;
189 int bus_clk = 133; 188 int bus_clk = 133;
190 189
191 mv64x60_wdt_timeout = 10; 190 mv64x60_wdt_timeout = 10;
@@ -202,7 +201,7 @@ static int __devinit mv64x60_wdt_probe(struct device *dev)
202 return misc_register(&mv64x60_wdt_miscdev); 201 return misc_register(&mv64x60_wdt_miscdev);
203} 202}
204 203
205static int __devexit mv64x60_wdt_remove(struct device *dev) 204static int __devexit mv64x60_wdt_remove(struct platform_device *dev)
206{ 205{
207 misc_deregister(&mv64x60_wdt_miscdev); 206 misc_deregister(&mv64x60_wdt_miscdev);
208 207
@@ -212,12 +211,13 @@ static int __devexit mv64x60_wdt_remove(struct device *dev)
212 return 0; 211 return 0;
213} 212}
214 213
215static struct device_driver mv64x60_wdt_driver = { 214static struct platform_driver mv64x60_wdt_driver = {
216 .owner = THIS_MODULE,
217 .name = MV64x60_WDT_NAME,
218 .bus = &platform_bus_type,
219 .probe = mv64x60_wdt_probe, 215 .probe = mv64x60_wdt_probe,
220 .remove = __devexit_p(mv64x60_wdt_remove), 216 .remove = __devexit_p(mv64x60_wdt_remove),
217 .driver = {
218 .owner = THIS_MODULE,
219 .name = MV64x60_WDT_NAME,
220 },
221}; 221};
222 222
223static struct platform_device *mv64x60_wdt_dev; 223static struct platform_device *mv64x60_wdt_dev;
@@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void)
235 goto out; 235 goto out;
236 } 236 }
237 237
238 ret = driver_register(&mv64x60_wdt_driver); 238 ret = platform_driver_register(&mv64x60_wdt_driver);
239 out: 239 out:
240 return ret; 240 return ret;
241} 241}
242 242
243static void __exit mv64x60_wdt_exit(void) 243static void __exit mv64x60_wdt_exit(void)
244{ 244{
245 driver_unregister(&mv64x60_wdt_driver); 245 platform_driver_unregister(&mv64x60_wdt_driver);
246 platform_device_unregister(mv64x60_wdt_dev); 246 platform_device_unregister(mv64x60_wdt_dev);
247} 247}
248 248
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c
index d9ef55bdf88a..2451edbefece 100644
--- a/drivers/char/watchdog/pcwd_pci.c
+++ b/drivers/char/watchdog/pcwd_pci.c
@@ -755,7 +755,6 @@ static struct pci_device_id pcipcwd_pci_tbl[] = {
755MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl); 755MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl);
756 756
757static struct pci_driver pcipcwd_driver = { 757static struct pci_driver pcipcwd_driver = {
758 .owner = THIS_MODULE,
759 .name = WATCHDOG_NAME, 758 .name = WATCHDOG_NAME,
760 .id_table = pcipcwd_pci_tbl, 759 .id_table = pcipcwd_pci_tbl,
761 .probe = pcipcwd_card_init, 760 .probe = pcipcwd_card_init,
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index 751cb77b0715..eb667daee19b 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
347} 347}
348/* device interface */ 348/* device interface */
349 349
350static int s3c2410wdt_probe(struct device *dev) 350static int s3c2410wdt_probe(struct platform_device *pdev)
351{ 351{
352 struct platform_device *pdev = to_platform_device(dev);
353 struct resource *res; 352 struct resource *res;
354 int started = 0; 353 int started = 0;
355 int ret; 354 int ret;
356 int size; 355 int size;
357 356
358 DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); 357 DBG("%s: probe=%p\n", __FUNCTION__, pdev);
359 358
360 /* get the memory region for the watchdog timer */ 359 /* get the memory region for the watchdog timer */
361 360
@@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev)
386 return -ENOENT; 385 return -ENOENT;
387 } 386 }
388 387
389 ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); 388 ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev);
390 if (ret != 0) { 389 if (ret != 0) {
391 printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); 390 printk(KERN_INFO PFX "failed to install irq (%d)\n", ret);
392 return ret; 391 return ret;
393 } 392 }
394 393
395 wdt_clock = clk_get(dev, "watchdog"); 394 wdt_clock = clk_get(&pdev->dev, "watchdog");
396 if (wdt_clock == NULL) { 395 if (wdt_clock == NULL) {
397 printk(KERN_INFO PFX "failed to find watchdog clock source\n"); 396 printk(KERN_INFO PFX "failed to find watchdog clock source\n");
398 return -ENOENT; 397 return -ENOENT;
@@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev)
430 return 0; 429 return 0;
431} 430}
432 431
433static int s3c2410wdt_remove(struct device *dev) 432static int s3c2410wdt_remove(struct platform_device *dev)
434{ 433{
435 if (wdt_mem != NULL) { 434 if (wdt_mem != NULL) {
436 release_resource(wdt_mem); 435 release_resource(wdt_mem);
@@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev)
454 return 0; 453 return 0;
455} 454}
456 455
457static void s3c2410wdt_shutdown(struct device *dev) 456static void s3c2410wdt_shutdown(struct platform_device *dev)
458{ 457{
459 s3c2410wdt_stop(); 458 s3c2410wdt_stop();
460} 459}
@@ -464,7 +463,7 @@ static void s3c2410wdt_shutdown(struct device *dev)
464static unsigned long wtcon_save; 463static unsigned long wtcon_save;
465static unsigned long wtdat_save; 464static unsigned long wtdat_save;
466 465
467static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) 466static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
468{ 467{
469 /* Save watchdog state, and turn it off. */ 468 /* Save watchdog state, and turn it off. */
470 wtcon_save = readl(wdt_base + S3C2410_WTCON); 469 wtcon_save = readl(wdt_base + S3C2410_WTCON);
@@ -476,7 +475,7 @@ static int s3c2410wdt_suspend(struct device *dev, pm_message_t state)
476 return 0; 475 return 0;
477} 476}
478 477
479static int s3c2410wdt_resume(struct device *dev) 478static int s3c2410wdt_resume(struct platform_device *dev)
480{ 479{
481 /* Restore watchdog state. */ 480 /* Restore watchdog state. */
482 481
@@ -496,15 +495,16 @@ static int s3c2410wdt_resume(struct device *dev)
496#endif /* CONFIG_PM */ 495#endif /* CONFIG_PM */
497 496
498 497
499static struct device_driver s3c2410wdt_driver = { 498static struct platform_driver s3c2410wdt_driver = {
500 .owner = THIS_MODULE,
501 .name = "s3c2410-wdt",
502 .bus = &platform_bus_type,
503 .probe = s3c2410wdt_probe, 499 .probe = s3c2410wdt_probe,
504 .remove = s3c2410wdt_remove, 500 .remove = s3c2410wdt_remove,
505 .shutdown = s3c2410wdt_shutdown, 501 .shutdown = s3c2410wdt_shutdown,
506 .suspend = s3c2410wdt_suspend, 502 .suspend = s3c2410wdt_suspend,
507 .resume = s3c2410wdt_resume, 503 .resume = s3c2410wdt_resume,
504 .driver = {
505 .owner = THIS_MODULE,
506 .name = "s3c2410-wdt",
507 },
508}; 508};
509 509
510 510
@@ -513,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si
513static int __init watchdog_init(void) 513static int __init watchdog_init(void)
514{ 514{
515 printk(banner); 515 printk(banner);
516 return driver_register(&s3c2410wdt_driver); 516 return platform_driver_register(&s3c2410wdt_driver);
517} 517}
518 518
519static void __exit watchdog_exit(void) 519static void __exit watchdog_exit(void)
520{ 520{
521 driver_unregister(&s3c2410wdt_driver); 521 platform_driver_unregister(&s3c2410wdt_driver);
522} 522}
523 523
524module_init(watchdog_init); 524module_init(watchdog_init);
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c
index 619e2ffca33f..dacfe31caccf 100644
--- a/drivers/char/watchdog/wdrtas.c
+++ b/drivers/char/watchdog/wdrtas.c
@@ -320,7 +320,7 @@ static int
320wdrtas_ioctl(struct inode *inode, struct file *file, 320wdrtas_ioctl(struct inode *inode, struct file *file,
321 unsigned int cmd, unsigned long arg) 321 unsigned int cmd, unsigned long arg)
322{ 322{
323 int __user *argp = (void *)arg; 323 int __user *argp = (void __user *)arg;
324 int i; 324 int i;
325 static struct watchdog_info wdinfo = { 325 static struct watchdog_info wdinfo = {
326 .options = WDRTAS_SUPPORTED_MASK, 326 .options = WDRTAS_SUPPORTED_MASK,
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c
index dc9370f6c348..4b3311993d48 100644
--- a/drivers/char/watchdog/wdt_pci.c
+++ b/drivers/char/watchdog/wdt_pci.c
@@ -711,7 +711,6 @@ MODULE_DEVICE_TABLE(pci, wdtpci_pci_tbl);
711 711
712 712
713static struct pci_driver wdtpci_driver = { 713static struct pci_driver wdtpci_driver = {
714 .owner = THIS_MODULE,
715 .name = "wdt_pci", 714 .name = "wdt_pci",
716 .id_table = wdtpci_pci_tbl, 715 .id_table = wdtpci_pci_tbl,
717 .probe = wdtpci_init_one, 716 .probe = wdtpci_init_one,