diff options
author | Jean Delvare <jdelvare@suse.de> | 2014-03-14 08:07:40 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2014-03-31 07:34:44 -0400 |
commit | acaaaf62c94a786f68b35cd06979fbd2fcedc89b (patch) | |
tree | f2a7cc1867a97e9416ba896304c719bb1551706d /drivers/watchdog/advantechwdt.c | |
parent | b0e0b4b5984ab1d59bc8569d28e499820b8ea8d8 (diff) |
watchdog: advantechwdt: 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/advantechwdt.c')
-rw-r--r-- | drivers/watchdog/advantechwdt.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index a8961addc59c..7796db7fa6e1 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c | |||
@@ -238,7 +238,7 @@ static struct miscdevice advwdt_miscdev = { | |||
238 | * Init & exit routines | 238 | * Init & exit routines |
239 | */ | 239 | */ |
240 | 240 | ||
241 | static int advwdt_probe(struct platform_device *dev) | 241 | static int __init advwdt_probe(struct platform_device *dev) |
242 | { | 242 | { |
243 | int ret; | 243 | int ret; |
244 | 244 | ||
@@ -299,7 +299,6 @@ static void advwdt_shutdown(struct platform_device *dev) | |||
299 | } | 299 | } |
300 | 300 | ||
301 | static struct platform_driver advwdt_driver = { | 301 | static struct platform_driver advwdt_driver = { |
302 | .probe = advwdt_probe, | ||
303 | .remove = advwdt_remove, | 302 | .remove = advwdt_remove, |
304 | .shutdown = advwdt_shutdown, | 303 | .shutdown = advwdt_shutdown, |
305 | .driver = { | 304 | .driver = { |
@@ -314,21 +313,19 @@ static int __init advwdt_init(void) | |||
314 | 313 | ||
315 | pr_info("WDT driver for Advantech single board computer initialising\n"); | 314 | pr_info("WDT driver for Advantech single board computer initialising\n"); |
316 | 315 | ||
317 | err = platform_driver_register(&advwdt_driver); | ||
318 | if (err) | ||
319 | return err; | ||
320 | |||
321 | advwdt_platform_device = platform_device_register_simple(DRV_NAME, | 316 | advwdt_platform_device = platform_device_register_simple(DRV_NAME, |
322 | -1, NULL, 0); | 317 | -1, NULL, 0); |
323 | if (IS_ERR(advwdt_platform_device)) { | 318 | if (IS_ERR(advwdt_platform_device)) |
324 | err = PTR_ERR(advwdt_platform_device); | 319 | return PTR_ERR(advwdt_platform_device); |
325 | goto unreg_platform_driver; | 320 | |
326 | } | 321 | err = platform_driver_probe(&advwdt_driver, advwdt_probe); |
322 | if (err) | ||
323 | goto unreg_platform_device; | ||
327 | 324 | ||
328 | return 0; | 325 | return 0; |
329 | 326 | ||
330 | unreg_platform_driver: | 327 | unreg_platform_device: |
331 | platform_driver_unregister(&advwdt_driver); | 328 | platform_device_unregister(advwdt_platform_device); |
332 | return err; | 329 | return err; |
333 | } | 330 | } |
334 | 331 | ||