aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-03-14 08:18:47 -0400
committerWim Van Sebroeck <wim@iguana.be>2014-03-31 07:35:26 -0400
commit996735ffd4560ee12d8dd98ad9d27379ee943890 (patch)
tree13988707574e0cf78ce408558d04317b927b6236
parent78411be4c7136054dab4635d2dbd848c3c9f7eae (diff)
watchdog: ib700wdt: Use platform_driver_probe
Using platform_driver_probe instead of platform_driver_register has two benefits: * The driver will fail to load if device probing fails. * The probe function can be marked __init. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/ib700wdt.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index 7ae36690c449..4247c498ee78 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -277,7 +277,7 @@ static struct miscdevice ibwdt_miscdev = {
277 * Init & exit routines 277 * Init & exit routines
278 */ 278 */
279 279
280static int ibwdt_probe(struct platform_device *dev) 280static int __init ibwdt_probe(struct platform_device *dev)
281{ 281{
282 int res; 282 int res;
283 283
@@ -336,7 +336,6 @@ static void ibwdt_shutdown(struct platform_device *dev)
336} 336}
337 337
338static struct platform_driver ibwdt_driver = { 338static struct platform_driver ibwdt_driver = {
339 .probe = ibwdt_probe,
340 .remove = ibwdt_remove, 339 .remove = ibwdt_remove,
341 .shutdown = ibwdt_shutdown, 340 .shutdown = ibwdt_shutdown,
342 .driver = { 341 .driver = {
@@ -351,21 +350,19 @@ static int __init ibwdt_init(void)
351 350
352 pr_info("WDT driver for IB700 single board computer initialising\n"); 351 pr_info("WDT driver for IB700 single board computer initialising\n");
353 352
354 err = platform_driver_register(&ibwdt_driver);
355 if (err)
356 return err;
357
358 ibwdt_platform_device = platform_device_register_simple(DRV_NAME, 353 ibwdt_platform_device = platform_device_register_simple(DRV_NAME,
359 -1, NULL, 0); 354 -1, NULL, 0);
360 if (IS_ERR(ibwdt_platform_device)) { 355 if (IS_ERR(ibwdt_platform_device))
361 err = PTR_ERR(ibwdt_platform_device); 356 return PTR_ERR(ibwdt_platform_device);
362 goto unreg_platform_driver; 357
363 } 358 err = platform_driver_probe(&ibwdt_driver, ibwdt_probe);
359 if (err)
360 goto unreg_platform_device;
364 361
365 return 0; 362 return 0;
366 363
367unreg_platform_driver: 364unreg_platform_device:
368 platform_driver_unregister(&ibwdt_driver); 365 platform_device_unregister(ibwdt_platform_device);
369 return err; 366 return err;
370} 367}
371 368