aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/acquirewdt.c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-03-14 08:04:37 -0400
committerWim Van Sebroeck <wim@iguana.be>2014-03-31 07:34:30 -0400
commitb0e0b4b5984ab1d59bc8569d28e499820b8ea8d8 (patch)
tree30b60ccd17c9782b63987b95cbf9e68db979ba2a /drivers/watchdog/acquirewdt.c
parentc90789baa8cec363093c5ec292c989b6f22d8f32 (diff)
watchdog: acquirewdt: 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>
Diffstat (limited to 'drivers/watchdog/acquirewdt.c')
-rw-r--r--drivers/watchdog/acquirewdt.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index 5cf1621def9c..5614416f1032 100644
--- a/drivers/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
@@ -239,7 +239,7 @@ static struct miscdevice acq_miscdev = {
239 * Init & exit routines 239 * Init & exit routines
240 */ 240 */
241 241
242static int acq_probe(struct platform_device *dev) 242static int __init acq_probe(struct platform_device *dev)
243{ 243{
244 int ret; 244 int ret;
245 245
@@ -291,7 +291,6 @@ static void acq_shutdown(struct platform_device *dev)
291} 291}
292 292
293static struct platform_driver acquirewdt_driver = { 293static struct platform_driver acquirewdt_driver = {
294 .probe = acq_probe,
295 .remove = acq_remove, 294 .remove = acq_remove,
296 .shutdown = acq_shutdown, 295 .shutdown = acq_shutdown,
297 .driver = { 296 .driver = {
@@ -306,20 +305,18 @@ static int __init acq_init(void)
306 305
307 pr_info("WDT driver for Acquire single board computer initialising\n"); 306 pr_info("WDT driver for Acquire single board computer initialising\n");
308 307
309 err = platform_driver_register(&acquirewdt_driver);
310 if (err)
311 return err;
312
313 acq_platform_device = platform_device_register_simple(DRV_NAME, 308 acq_platform_device = platform_device_register_simple(DRV_NAME,
314 -1, NULL, 0); 309 -1, NULL, 0);
315 if (IS_ERR(acq_platform_device)) { 310 if (IS_ERR(acq_platform_device))
316 err = PTR_ERR(acq_platform_device); 311 return PTR_ERR(acq_platform_device);
317 goto unreg_platform_driver; 312
318 } 313 err = platform_driver_probe(&acquirewdt_driver, acq_probe);
314 if (err)
315 goto unreg_platform_device;
319 return 0; 316 return 0;
320 317
321unreg_platform_driver: 318unreg_platform_device:
322 platform_driver_unregister(&acquirewdt_driver); 319 platform_device_unregister(acq_platform_device);
323 return err; 320 return err;
324} 321}
325 322