From: Dmitry Torokhov Date: Wed, 22 Mar 2006 08:07:54 +0000 (-0800) Subject: [PATCH] mv64x600_wdt: convert to the new platform device interface X-Git-Tag: v2.6.17-rc1~1129^2~89 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eee8ab75c609fa0c452246f69237ff577b931243;p=linux-2.6 [PATCH] mv64x600_wdt: convert to the new platform device interface mv64x600_wdt: convert to the new platform device interface Do not use platform_device_register_simple() as it is going away. Signed-off-by: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 00d9ef04a3..f1b9cf89f1 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c @@ -228,15 +228,25 @@ static int __init mv64x60_wdt_init(void) printk(KERN_INFO "MV64x60 watchdog driver\n"); - mv64x60_wdt_dev = platform_device_register_simple(MV64x60_WDT_NAME, - -1, NULL, 0); - if (IS_ERR(mv64x60_wdt_dev)) { - ret = PTR_ERR(mv64x60_wdt_dev); + mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1); + if (!mv64x60_wdt_dev) { + ret = -ENOMEM; + goto out; + } + + ret = platform_device_add(mv64x60_wdt_dev); + if (ret) { + platform_device_put(mv64x60_wdt_dev); goto out; } ret = platform_driver_register(&mv64x60_wdt_driver); - out: + if (ret) { + platform_device_unregister(mv64x60_wdt_dev); + goto out; + } + + out: return ret; }