浏览代码

[PATCH] x86: Unify pcspeaker platform device code between i386/x86-64

Trivial cleanup.

Only change is that it is always compiled in now on x86-64 like on i386.

Signed-off-by: Andi Kleen <ak@suse.de>
Andi Kleen 18 年之前
父节点
当前提交
62cc49396e
共有 5 个文件被更改,包括 23 次插入46 次删除
  1. 1 0
      arch/i386/kernel/Makefile
  2. 20 0
      arch/i386/kernel/pcspeaker.c
  3. 0 26
      arch/i386/kernel/setup.c
  4. 2 0
      arch/x86_64/kernel/Makefile
  5. 0 20
      arch/x86_64/kernel/setup.c

+ 1 - 0
arch/i386/kernel/Makefile

@@ -42,6 +42,7 @@ obj-$(CONFIG_K8_NB)		+= k8.o
 
 
 obj-$(CONFIG_VMI)		+= vmi.o vmitime.o
 obj-$(CONFIG_VMI)		+= vmi.o vmitime.o
 obj-$(CONFIG_PARAVIRT)		+= paravirt.o
 obj-$(CONFIG_PARAVIRT)		+= paravirt.o
+obj-y				+= pcspeaker.o
 
 
 EXTRA_AFLAGS   := -traditional
 EXTRA_AFLAGS   := -traditional
 
 

+ 20 - 0
arch/i386/kernel/pcspeaker.c

@@ -0,0 +1,20 @@
+#include <linux/platform_device.h>
+#include <linux/errno.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;
+
+	ret = platform_device_add(pd);
+	if (ret)
+		platform_device_put(pd);
+
+	return ret;
+}
+device_initcall(add_pcspkr);

+ 0 - 26
arch/i386/kernel/setup.c

@@ -33,7 +33,6 @@
 #include <linux/initrd.h>
 #include <linux/initrd.h>
 #include <linux/bootmem.h>
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
 #include <linux/seq_file.h>
-#include <linux/platform_device.h>
 #include <linux/console.h>
 #include <linux/console.h>
 #include <linux/mca.h>
 #include <linux/mca.h>
 #include <linux/root_dev.h>
 #include <linux/root_dev.h>
@@ -660,28 +659,3 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
 	tsc_init();
 	tsc_init();
 }
 }
-
-static __init int add_pcspkr(void)
-{
-	struct platform_device *pd;
-	int ret;
-
-	pd = platform_device_alloc("pcspkr", -1);
-	if (!pd)
-		return -ENOMEM;
-
-	ret = platform_device_add(pd);
-	if (ret)
-		platform_device_put(pd);
-
-	return ret;
-}
-device_initcall(add_pcspkr);
-
-/*
- * Local Variables:
- * mode:c
- * c-file-style:"k&r"
- * c-basic-offset:8
- * End:
- */

+ 2 - 0
arch/x86_64/kernel/Makefile

@@ -43,6 +43,7 @@ obj-$(CONFIG_PCI)		+= early-quirks.o
 
 
 obj-y				+= topology.o
 obj-y				+= topology.o
 obj-y				+= intel_cacheinfo.o
 obj-y				+= intel_cacheinfo.o
+obj-y				+= pcspeaker.o
 
 
 CFLAGS_vsyscall.o		:= $(PROFILING) -g0
 CFLAGS_vsyscall.o		:= $(PROFILING) -g0
 
 
@@ -56,3 +57,4 @@ quirks-y			+= ../../i386/kernel/quirks.o
 i8237-y				+= ../../i386/kernel/i8237.o
 i8237-y				+= ../../i386/kernel/i8237.o
 msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
 msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
 alternative-y			+= ../../i386/kernel/alternative.o
 alternative-y			+= ../../i386/kernel/alternative.o
+pcspeaker-y			+= ../../i386/kernel/pcspeaker.o

+ 0 - 20
arch/x86_64/kernel/setup.c

@@ -1104,23 +1104,3 @@ struct seq_operations cpuinfo_op = {
 	.stop =	c_stop,
 	.stop =	c_stop,
 	.show =	show_cpuinfo,
 	.show =	show_cpuinfo,
 };
 };
-
-#if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
-#include <linux/platform_device.h>
-static __init int add_pcspkr(void)
-{
-	struct platform_device *pd;
-	int ret;
-
-	pd = platform_device_alloc("pcspkr", -1);
-	if (!pd)
-		return -ENOMEM;
-
-	ret = platform_device_add(pd);
-	if (ret)
-		platform_device_put(pd);
-
-	return ret;
-}
-device_initcall(add_pcspkr);
-#endif