diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/char/watchdog | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r-- | drivers/char/watchdog/mpcore_wdt.c | 30 | ||||
-rw-r--r-- | drivers/char/watchdog/mv64x60_wdt.c | 20 | ||||
-rw-r--r-- | drivers/char/watchdog/s3c2410_wdt.c | 30 |
3 files changed, 40 insertions, 40 deletions
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index da631c114fd1..9defcf861b67 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 | */ |
140 | static int mpcore_wdt_open(struct inode *inode, struct file *file) | 140 | static 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; |
@@ -291,9 +291,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file, | |||
291 | * System shutdown handler. Turn off the watchdog if we're | 291 | * System shutdown handler. Turn off the watchdog if we're |
292 | * restarting or halting the system. | 292 | * restarting or halting the system. |
293 | */ | 293 | */ |
294 | static void mpcore_wdt_shutdown(struct device *_dev) | 294 | static void mpcore_wdt_shutdown(struct platform_device *dev) |
295 | { | 295 | { |
296 | struct mpcore_wdt *wdt = dev_get_drvdata(_dev); | 296 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); |
297 | 297 | ||
298 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) | 298 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) |
299 | mpcore_wdt_stop(wdt); | 299 | mpcore_wdt_stop(wdt); |
@@ -317,9 +317,8 @@ static struct miscdevice mpcore_wdt_miscdev = { | |||
317 | .fops = &mpcore_wdt_fops, | 317 | .fops = &mpcore_wdt_fops, |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static int __devinit mpcore_wdt_probe(struct device *_dev) | 320 | static int __devinit mpcore_wdt_probe(struct platform_device *dev) |
321 | { | 321 | { |
322 | struct platform_device *dev = to_platform_device(_dev); | ||
323 | struct mpcore_wdt *wdt; | 322 | struct mpcore_wdt *wdt; |
324 | struct resource *res; | 323 | struct resource *res; |
325 | int ret; | 324 | int ret; |
@@ -364,7 +363,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev) | |||
364 | } | 363 | } |
365 | 364 | ||
366 | mpcore_wdt_stop(wdt); | 365 | mpcore_wdt_stop(wdt); |
367 | dev_set_drvdata(&dev->dev, wdt); | 366 | platform_set_drvdata(&dev->dev, wdt); |
368 | mpcore_wdt_dev = dev; | 367 | mpcore_wdt_dev = dev; |
369 | 368 | ||
370 | return 0; | 369 | return 0; |
@@ -379,11 +378,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev) | |||
379 | return ret; | 378 | return ret; |
380 | } | 379 | } |
381 | 380 | ||
382 | static int __devexit mpcore_wdt_remove(struct device *dev) | 381 | static int __devexit mpcore_wdt_remove(struct platform_device *dev) |
383 | { | 382 | { |
384 | struct mpcore_wdt *wdt = dev_get_drvdata(dev); | 383 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); |
385 | 384 | ||
386 | dev_set_drvdata(dev, NULL); | 385 | platform_set_drvdata(dev, NULL); |
387 | 386 | ||
388 | misc_deregister(&mpcore_wdt_miscdev); | 387 | misc_deregister(&mpcore_wdt_miscdev); |
389 | 388 | ||
@@ -395,13 +394,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev) | |||
395 | return 0; | 394 | return 0; |
396 | } | 395 | } |
397 | 396 | ||
398 | static struct device_driver mpcore_wdt_driver = { | 397 | static struct platform_driver mpcore_wdt_driver = { |
399 | .owner = THIS_MODULE, | ||
400 | .name = "mpcore_wdt", | ||
401 | .bus = &platform_bus_type, | ||
402 | .probe = mpcore_wdt_probe, | 398 | .probe = mpcore_wdt_probe, |
403 | .remove = __devexit_p(mpcore_wdt_remove), | 399 | .remove = __devexit_p(mpcore_wdt_remove), |
404 | .shutdown = mpcore_wdt_shutdown, | 400 | .shutdown = mpcore_wdt_shutdown, |
401 | .driver = { | ||
402 | .owner = THIS_MODULE, | ||
403 | .name = "mpcore_wdt", | ||
404 | }, | ||
405 | }; | 405 | }; |
406 | 406 | ||
407 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; | 407 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; |
@@ -420,12 +420,12 @@ static int __init mpcore_wdt_init(void) | |||
420 | 420 | ||
421 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); | 421 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); |
422 | 422 | ||
423 | return driver_register(&mpcore_wdt_driver); | 423 | return platform_driver_register(&mpcore_wdt_driver); |
424 | } | 424 | } |
425 | 425 | ||
426 | static void __exit mpcore_wdt_exit(void) | 426 | static void __exit mpcore_wdt_exit(void) |
427 | { | 427 | { |
428 | driver_unregister(&mpcore_wdt_driver); | 428 | platform_driver_unregister(&mpcore_wdt_driver); |
429 | } | 429 | } |
430 | 430 | ||
431 | module_init(mpcore_wdt_init); | 431 | module_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 | ||
185 | static int __devinit mv64x60_wdt_probe(struct device *dev) | 185 | static 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 | ||
205 | static int __devexit mv64x60_wdt_remove(struct device *dev) | 204 | static 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 | ||
215 | static struct device_driver mv64x60_wdt_driver = { | 214 | static 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 | ||
223 | static struct platform_device *mv64x60_wdt_dev; | 223 | static 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 | ||
243 | static void __exit mv64x60_wdt_exit(void) | 243 | static 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/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 | ||
350 | static int s3c2410wdt_probe(struct device *dev) | 350 | static 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 | ||
433 | static int s3c2410wdt_remove(struct device *dev) | 432 | static 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 | ||
457 | static void s3c2410wdt_shutdown(struct device *dev) | 456 | static 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) | |||
464 | static unsigned long wtcon_save; | 463 | static unsigned long wtcon_save; |
465 | static unsigned long wtdat_save; | 464 | static unsigned long wtdat_save; |
466 | 465 | ||
467 | static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) | 466 | static 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 | ||
479 | static int s3c2410wdt_resume(struct device *dev) | 478 | static 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 | ||
499 | static struct device_driver s3c2410wdt_driver = { | 498 | static 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 | |||
513 | static int __init watchdog_init(void) | 513 | static 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 | ||
519 | static void __exit watchdog_exit(void) | 519 | static void __exit watchdog_exit(void) |
520 | { | 520 | { |
521 | driver_unregister(&s3c2410wdt_driver); | 521 | platform_driver_unregister(&s3c2410wdt_driver); |
522 | } | 522 | } |
523 | 523 | ||
524 | module_init(watchdog_init); | 524 | module_init(watchdog_init); |