diff options
author | Michael Neuling <mikey@neuling.org> | 2006-03-14 00:11:50 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-14 00:11:50 -0500 |
commit | e5c6c8e457d16c7cbc12f849ad18d4d508950de2 (patch) | |
tree | 25a6342ef5fa5ae19f1fbaed8538290225dba38d /arch | |
parent | aaef685d5726768d25cbdc672a59c284d820b82e (diff) |
Input: pcspkr - separate device and driver registration
The current pcspkr code combines the device and driver registration.
This patch splits these, putting the device registration in the arch
specific code.
PowerPC and MIPS only have the pcspkr present sometimes.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/setup.c | 18 | ||||
-rw-r--r-- | arch/i386/kernel/setup.c | 18 | ||||
-rw-r--r-- | arch/mips/Kconfig | 6 | ||||
-rw-r--r-- | arch/mips/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/kernel/i8253.c | 28 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 24 |
6 files changed, 96 insertions, 0 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index b4e5f8ff2b25..fa3f1a354b3f 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
31 | #include <linux/platform_device.h> | ||
31 | #include <linux/bootmem.h> | 32 | #include <linux/bootmem.h> |
32 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
33 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
@@ -1484,3 +1485,20 @@ alpha_panic_event(struct notifier_block *this, unsigned long event, void *ptr) | |||
1484 | #endif | 1485 | #endif |
1485 | return NOTIFY_DONE; | 1486 | return NOTIFY_DONE; |
1486 | } | 1487 | } |
1488 | |||
1489 | static __init int add_pcspkr(void) | ||
1490 | { | ||
1491 | struct platform_device *pd; | ||
1492 | int ret; | ||
1493 | |||
1494 | pd = platform_device_alloc("pcspkr", -1); | ||
1495 | if (!pd) | ||
1496 | return -ENOMEM; | ||
1497 | |||
1498 | ret = platform_device_add(pd); | ||
1499 | if (ret) | ||
1500 | platform_device_put(pd); | ||
1501 | |||
1502 | return ret; | ||
1503 | } | ||
1504 | device_initcall(add_pcspkr); | ||
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index ab62a9f4701e..a0b407585679 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/initrd.h> | 34 | #include <linux/initrd.h> |
35 | #include <linux/bootmem.h> | 35 | #include <linux/bootmem.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/platform_device.h> | ||
37 | #include <linux/console.h> | 38 | #include <linux/console.h> |
38 | #include <linux/mca.h> | 39 | #include <linux/mca.h> |
39 | #include <linux/root_dev.h> | 40 | #include <linux/root_dev.h> |
@@ -1634,6 +1635,23 @@ void __init setup_arch(char **cmdline_p) | |||
1634 | #endif | 1635 | #endif |
1635 | } | 1636 | } |
1636 | 1637 | ||
1638 | static __init int add_pcspkr(void) | ||
1639 | { | ||
1640 | struct platform_device *pd; | ||
1641 | int ret; | ||
1642 | |||
1643 | pd = platform_device_alloc("pcspkr", -1); | ||
1644 | if (!pd) | ||
1645 | return -ENOMEM; | ||
1646 | |||
1647 | ret = platform_device_add(pd); | ||
1648 | if (ret) | ||
1649 | platform_device_put(pd); | ||
1650 | |||
1651 | return ret; | ||
1652 | } | ||
1653 | device_initcall(add_pcspkr); | ||
1654 | |||
1637 | #include "setup_arch_post.h" | 1655 | #include "setup_arch_post.h" |
1638 | /* | 1656 | /* |
1639 | * Local Variables: | 1657 | * Local Variables: |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 3a0f89d2c8dc..6d4333776d28 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -233,6 +233,7 @@ config MACH_JAZZ | |||
233 | select ARC32 | 233 | select ARC32 |
234 | select ARCH_MAY_HAVE_PC_FDC | 234 | select ARCH_MAY_HAVE_PC_FDC |
235 | select GENERIC_ISA_DMA | 235 | select GENERIC_ISA_DMA |
236 | select I8253 | ||
236 | select I8259 | 237 | select I8259 |
237 | select ISA | 238 | select ISA |
238 | select SYS_HAS_CPU_R4X00 | 239 | select SYS_HAS_CPU_R4X00 |
@@ -530,6 +531,7 @@ config QEMU | |||
530 | select DMA_COHERENT | 531 | select DMA_COHERENT |
531 | select GENERIC_ISA_DMA | 532 | select GENERIC_ISA_DMA |
532 | select HAVE_STD_PC_SERIAL_PORT | 533 | select HAVE_STD_PC_SERIAL_PORT |
534 | select I8253 | ||
533 | select I8259 | 535 | select I8259 |
534 | select ISA | 536 | select ISA |
535 | select SWAP_IO_SPACE | 537 | select SWAP_IO_SPACE |
@@ -714,6 +716,7 @@ config SNI_RM200_PCI | |||
714 | select HAVE_STD_PC_SERIAL_PORT | 716 | select HAVE_STD_PC_SERIAL_PORT |
715 | select HW_HAS_EISA | 717 | select HW_HAS_EISA |
716 | select HW_HAS_PCI | 718 | select HW_HAS_PCI |
719 | select I8253 | ||
717 | select I8259 | 720 | select I8259 |
718 | select ISA | 721 | select ISA |
719 | select SYS_HAS_CPU_R4X00 | 722 | select SYS_HAS_CPU_R4X00 |
@@ -1711,6 +1714,9 @@ config MMU | |||
1711 | bool | 1714 | bool |
1712 | default y | 1715 | default y |
1713 | 1716 | ||
1717 | config I8253 | ||
1718 | bool | ||
1719 | |||
1714 | source "drivers/pcmcia/Kconfig" | 1720 | source "drivers/pcmcia/Kconfig" |
1715 | 1721 | ||
1716 | source "drivers/pci/hotplug/Kconfig" | 1722 | source "drivers/pci/hotplug/Kconfig" |
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index f36c4f20ee8a..309d54cceda3 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -59,6 +59,8 @@ obj-$(CONFIG_PROC_FS) += proc.o | |||
59 | 59 | ||
60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o | 60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o |
61 | 61 | ||
62 | obj-$(CONFIG_I8253) += i8253.o | ||
63 | |||
62 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | 64 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) |
63 | 65 | ||
64 | EXTRA_AFLAGS := $(CFLAGS) | 66 | EXTRA_AFLAGS := $(CFLAGS) |
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c new file mode 100644 index 000000000000..475df6904219 --- /dev/null +++ b/arch/mips/kernel/i8253.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 IBM Corporation | ||
3 | * | ||
4 | * Implements device information for i8253 timer chip | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | |||
13 | static __init int add_pcspkr(void) | ||
14 | { | ||
15 | struct platform_device *pd; | ||
16 | int ret; | ||
17 | |||
18 | pd = platform_device_alloc("pcspkr", -1); | ||
19 | if (!pd) | ||
20 | return -ENOMEM; | ||
21 | |||
22 | ret = platform_device_add(pd); | ||
23 | if (ret) | ||
24 | platform_device_put(pd); | ||
25 | |||
26 | return ret; | ||
27 | } | ||
28 | device_initcall(add_pcspkr); | ||
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index be12041c0fc5..fc89d009d18d 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/initrd.h> | 20 | #include <linux/initrd.h> |
21 | #include <linux/platform_device.h> | ||
21 | #include <linux/ide.h> | 22 | #include <linux/ide.h> |
22 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
23 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
@@ -469,3 +470,26 @@ static int __init early_xmon(char *p) | |||
469 | } | 470 | } |
470 | early_param("xmon", early_xmon); | 471 | early_param("xmon", early_xmon); |
471 | #endif | 472 | #endif |
473 | |||
474 | static __init int add_pcspkr(void) | ||
475 | { | ||
476 | struct device_node *np; | ||
477 | struct platform_device *pd; | ||
478 | int ret; | ||
479 | |||
480 | np = of_find_compatible_node(NULL, NULL, "pnpPNP,100"); | ||
481 | of_node_put(np); | ||
482 | if (!np) | ||
483 | return -ENODEV; | ||
484 | |||
485 | pd = platform_device_alloc("pcspkr", -1); | ||
486 | if (!pd) | ||
487 | return -ENOMEM; | ||
488 | |||
489 | ret = platform_device_add(pd); | ||
490 | if (ret) | ||
491 | platform_device_put(pd); | ||
492 | |||
493 | return ret; | ||
494 | } | ||
495 | device_initcall(add_pcspkr); | ||