x86: use platform_device_register_simple()
authorAkinobu Mita <akinobu.mita@gmail.com>
Sun, 21 Sep 2008 14:25:40 +0000 (23:25 +0900)
committerIngo Molnar <mingo@elte.hu>
Mon, 22 Sep 2008 10:58:36 +0000 (12:58 +0200)
Cleanup pcspeaker.c

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/pcspeaker.c

index bc1f2d3..a311ffc 100644 (file)
@@ -1,20 +1,13 @@
 #include <linux/platform_device.h>
-#include <linux/errno.h>
+#include <linux/err.h>
 #include <linux/init.h>
 
 static __init int add_pcspkr(void)
 {
        struct platform_device *pd;
-       int ret;
 
-       pd = platform_device_alloc("pcspkr", -1);
-       if (!pd)
-               return -ENOMEM;
+       pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
 
-       ret = platform_device_add(pd);
-       if (ret)
-               platform_device_put(pd);
-
-       return ret;
+       return IS_ERR(pd) ? PTR_ERR(pd) : 0;
 }
 device_initcall(add_pcspkr);