2005-12-15 05:45:56

by Dmitry Torokhov

[permalink] [raw]
Subject: [patch 1/3] wbsd: convert to the new platfrom device interface

wbsd: convert to the new platfrom device interface

platform_device_register_simple() is going away, switch to
using platfrom_device_alloc() + platform_device_add(). Also
make sure that wbsd_driver gets unregistered when wbsd_init
fails.

Signed-off-by: Dmitry Torokhov <[email protected]>
---

drivers/mmc/wbsd.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)

Index: work/drivers/mmc/wbsd.c
===================================================================
--- work.orig/drivers/mmc/wbsd.c
+++ work/drivers/mmc/wbsd.c
@@ -2090,10 +2090,20 @@ static int __init wbsd_drv_init(void)
if (result < 0)
return result;

- wbsd_device = platform_device_register_simple(DRIVER_NAME, -1,
- NULL, 0);
- if (IS_ERR(wbsd_device))
- return PTR_ERR(wbsd_device);
+ wbsd_device = platform_device_alloc(DRIVER_NAME, -1);
+ if (!wbsd_device)
+ {
+ platform_driver_unregister(&wbsd_driver);
+ return -ENOMEM;
+ }
+
+ result = platform_device_add(wbsd_device);
+ if (result)
+ {
+ platform_device_put(wbsd_device);
+ platform_driver_unregister(&wbsd_driver);
+ return result;
+ }
}

return 0;


2005-12-15 16:08:56

by Pierre Ossman

[permalink] [raw]
Subject: Re: [patch 1/3] wbsd: convert to the new platfrom device interface

Dmitry Torokhov wrote:
> wbsd: convert to the new platfrom device interface
>
> platform_device_register_simple() is going away, switch to
> using platfrom_device_alloc() + platform_device_add(). Also
> make sure that wbsd_driver gets unregistered when wbsd_init
> fails.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>
> ---
>
>

Acked-by: Pierre Ossman <[email protected]>