aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-02-13 07:26:26 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-02-13 07:26:26 -0500
commit62cc49396e593dd71c6595302bb10b085aefbfa5 (patch)
treea4487294b3ea5c6b4f90fb9b4fd46a64b852d450
parent40d22c1b5675e428b3f3f9a945d0bd62e94ca2f1 (diff)
[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>
-rw-r--r--arch/i386/kernel/Makefile1
-rw-r--r--arch/i386/kernel/pcspeaker.c20
-rw-r--r--arch/i386/kernel/setup.c26
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/setup.c20
5 files changed, 23 insertions, 46 deletions
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 223969377de4..cbe4e601885c 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_K8_NB) += k8.o
42 42
43obj-$(CONFIG_VMI) += vmi.o vmitime.o 43obj-$(CONFIG_VMI) += vmi.o vmitime.o
44obj-$(CONFIG_PARAVIRT) += paravirt.o 44obj-$(CONFIG_PARAVIRT) += paravirt.o
45obj-y += pcspeaker.o
45 46
46EXTRA_AFLAGS := -traditional 47EXTRA_AFLAGS := -traditional
47 48
diff --git a/arch/i386/kernel/pcspeaker.c b/arch/i386/kernel/pcspeaker.c
new file mode 100644
index 000000000000..bc1f2d3ea277
--- /dev/null
+++ b/arch/i386/kernel/pcspeaker.c
@@ -0,0 +1,20 @@
1#include <linux/platform_device.h>
2#include <linux/errno.h>
3#include <linux/init.h>
4
5static __init int add_pcspkr(void)
6{
7 struct platform_device *pd;
8 int ret;
9
10 pd = platform_device_alloc("pcspkr", -1);
11 if (!pd)
12 return -ENOMEM;
13
14 ret = platform_device_add(pd);
15 if (ret)
16 platform_device_put(pd);
17
18 return ret;
19}
20device_initcall(add_pcspkr);
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index bd8c218d94af..122623dcc6e1 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -33,7 +33,6 @@
33#include <linux/initrd.h> 33#include <linux/initrd.h>
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include <linux/seq_file.h> 35#include <linux/seq_file.h>
36#include <linux/platform_device.h>
37#include <linux/console.h> 36#include <linux/console.h>
38#include <linux/mca.h> 37#include <linux/mca.h>
39#include <linux/root_dev.h> 38#include <linux/root_dev.h>
@@ -660,28 +659,3 @@ void __init setup_arch(char **cmdline_p)
660#endif 659#endif
661 tsc_init(); 660 tsc_init();
662} 661}
663
664static __init int add_pcspkr(void)
665{
666 struct platform_device *pd;
667 int ret;
668
669 pd = platform_device_alloc("pcspkr", -1);
670 if (!pd)
671 return -ENOMEM;
672
673 ret = platform_device_add(pd);
674 if (ret)
675 platform_device_put(pd);
676
677 return ret;
678}
679device_initcall(add_pcspkr);
680
681/*
682 * Local Variables:
683 * mode:c
684 * c-file-style:"k&r"
685 * c-basic-offset:8
686 * End:
687 */
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 3c7cbff04d3d..ae399458024b 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_PCI) += early-quirks.o
43 43
44obj-y += topology.o 44obj-y += topology.o
45obj-y += intel_cacheinfo.o 45obj-y += intel_cacheinfo.o
46obj-y += pcspeaker.o
46 47
47CFLAGS_vsyscall.o := $(PROFILING) -g0 48CFLAGS_vsyscall.o := $(PROFILING) -g0
48 49
@@ -56,3 +57,4 @@ quirks-y += ../../i386/kernel/quirks.o
56i8237-y += ../../i386/kernel/i8237.o 57i8237-y += ../../i386/kernel/i8237.o
57msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 58msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
58alternative-y += ../../i386/kernel/alternative.o 59alternative-y += ../../i386/kernel/alternative.o
60pcspeaker-y += ../../i386/kernel/pcspeaker.o
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 13daaf359d21..3d98b696881d 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -1104,23 +1104,3 @@ struct seq_operations cpuinfo_op = {
1104 .stop = c_stop, 1104 .stop = c_stop,
1105 .show = show_cpuinfo, 1105 .show = show_cpuinfo,
1106}; 1106};
1107
1108#if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
1109#include <linux/platform_device.h>
1110static __init int add_pcspkr(void)
1111{
1112 struct platform_device *pd;
1113 int ret;
1114
1115 pd = platform_device_alloc("pcspkr", -1);
1116 if (!pd)
1117 return -ENOMEM;
1118
1119 ret = platform_device_add(pd);
1120 if (ret)
1121 platform_device_put(pd);
1122
1123 return ret;
1124}
1125device_initcall(add_pcspkr);
1126#endif