Commit 996735ff authored by Jean Delvare's avatar Jean Delvare Committed by Wim Van Sebroeck

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: default avatarJean Delvare <jdelvare@suse.de>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 78411be4
...@@ -277,7 +277,7 @@ static struct miscdevice ibwdt_miscdev = { ...@@ -277,7 +277,7 @@ static struct miscdevice ibwdt_miscdev = {
* Init & exit routines * Init & exit routines
*/ */
static int ibwdt_probe(struct platform_device *dev) static int __init ibwdt_probe(struct platform_device *dev)
{ {
int res; int res;
...@@ -336,7 +336,6 @@ static void ibwdt_shutdown(struct platform_device *dev) ...@@ -336,7 +336,6 @@ static void ibwdt_shutdown(struct platform_device *dev)
} }
static struct platform_driver ibwdt_driver = { static struct platform_driver ibwdt_driver = {
.probe = ibwdt_probe,
.remove = ibwdt_remove, .remove = ibwdt_remove,
.shutdown = ibwdt_shutdown, .shutdown = ibwdt_shutdown,
.driver = { .driver = {
...@@ -351,21 +350,19 @@ static int __init ibwdt_init(void) ...@@ -351,21 +350,19 @@ static int __init ibwdt_init(void)
pr_info("WDT driver for IB700 single board computer initialising\n"); pr_info("WDT driver for IB700 single board computer initialising\n");
err = platform_driver_register(&ibwdt_driver);
if (err)
return err;
ibwdt_platform_device = platform_device_register_simple(DRV_NAME, ibwdt_platform_device = platform_device_register_simple(DRV_NAME,
-1, NULL, 0); -1, NULL, 0);
if (IS_ERR(ibwdt_platform_device)) { if (IS_ERR(ibwdt_platform_device))
err = PTR_ERR(ibwdt_platform_device); return PTR_ERR(ibwdt_platform_device);
goto unreg_platform_driver;
} err = platform_driver_probe(&ibwdt_driver, ibwdt_probe);
if (err)
goto unreg_platform_device;
return 0; return 0;
unreg_platform_driver: unreg_platform_device:
platform_driver_unregister(&ibwdt_driver); platform_device_unregister(ibwdt_platform_device);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment