aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2008-01-29 05:14:57 -0500
committerRalf Baechle <ralf@linux-mips.org>2008-01-29 05:14:57 -0500
commit19388fb092d89e179575bd0b44f51b57e175edf5 (patch)
treed379d5657e85f026f57e1f193ab963b592a77711
parent0ab7aefc4d43a6dee26c891b41ef9c7a67d2379b (diff)
[MIPS] Cleanup pcspeaker platform device registration.
Move registration into the actual platform code instead of making a desparate attempt at sharing the hand full of likes of code in pcspeaker.c. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/jazz/setup.c7
-rw-r--r--arch/mips/kernel/pcspeaker.c28
-rw-r--r--arch/mips/qemu/q-setup.c15
-rw-r--r--arch/mips/sni/pcit.c7
5 files changed, 29 insertions, 34 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d5a89f3fdfd3..8cbdfd255670 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -132,7 +132,6 @@ config MACH_JAZZ
132 select I8253 132 select I8253
133 select I8259 133 select I8259
134 select ISA 134 select ISA
135 select PCSPEAKER
136 select SYS_HAS_CPU_R4X00 135 select SYS_HAS_CPU_R4X00
137 select SYS_SUPPORTS_32BIT_KERNEL 136 select SYS_SUPPORTS_32BIT_KERNEL
138 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL 137 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
@@ -378,7 +377,6 @@ config QEMU
378 select I8259 377 select I8259
379 select IRQ_CPU 378 select IRQ_CPU
380 select ISA 379 select ISA
381 select PCSPEAKER
382 select SWAP_IO_SPACE 380 select SWAP_IO_SPACE
383 select SYS_HAS_CPU_MIPS32_R1 381 select SYS_HAS_CPU_MIPS32_R1
384 select SYS_HAS_EARLY_PRINTK 382 select SYS_HAS_EARLY_PRINTK
@@ -590,7 +588,6 @@ config SNI_RM
590 select I8253 588 select I8253
591 select I8259 589 select I8259
592 select ISA 590 select ISA
593 select PCSPEAKER
594 select SWAP_IO_SPACE if CPU_BIG_ENDIAN 591 select SWAP_IO_SPACE if CPU_BIG_ENDIAN
595 select SYS_HAS_CPU_R4X00 592 select SYS_HAS_CPU_R4X00
596 select SYS_HAS_CPU_R5000 593 select SYS_HAS_CPU_R5000
@@ -1995,9 +1992,6 @@ config MMU
1995config I8253 1992config I8253
1996 bool 1993 bool
1997 1994
1998config PCSPEAKER
1999 bool
2000
2001config ZONE_DMA32 1995config ZONE_DMA32
2002 bool 1996 bool
2003 1997
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index a7857973ca03..a7947199c99b 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -200,12 +200,19 @@ static struct platform_device jazz_cmos_pdev = {
200 .resource = jazz_cmos_rsrc 200 .resource = jazz_cmos_rsrc
201}; 201};
202 202
203static struct platform_device pcspeaker_pdev = {
204 .name = "pcspkr",
205 .id = -1,
206};
207
203static int __init jazz_setup_devinit(void) 208static int __init jazz_setup_devinit(void)
204{ 209{
205 platform_device_register(&jazz_serial8250_device); 210 platform_device_register(&jazz_serial8250_device);
206 platform_device_register(&jazz_esp_pdev); 211 platform_device_register(&jazz_esp_pdev);
207 platform_device_register(&jazz_sonic_pdev); 212 platform_device_register(&jazz_sonic_pdev);
208 platform_device_register(&jazz_cmos_pdev); 213 platform_device_register(&jazz_cmos_pdev);
214 platform_device_register(&pcspeaker_pdev);
215
209 return 0; 216 return 0;
210} 217}
211 218
diff --git a/arch/mips/kernel/pcspeaker.c b/arch/mips/kernel/pcspeaker.c
deleted file mode 100644
index 475df6904219..000000000000
--- a/arch/mips/kernel/pcspeaker.c
+++ /dev/null
@@ -1,28 +0,0 @@
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
13static __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}
28device_initcall(add_pcspkr);
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 969cedc8d8b9..9f0c2d3c67ea 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -1,4 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/platform_device.h>
2 3
3#include <asm/i8253.h> 4#include <asm/i8253.h>
4#include <asm/io.h> 5#include <asm/io.h>
@@ -20,3 +21,17 @@ void __init plat_mem_setup(void)
20{ 21{
21 qemu_reboot_setup(); 22 qemu_reboot_setup();
22} 23}
24
25static struct platform_device pcspeaker_pdev = {
26 .name = "pcspkr",
27 .id = -1,
28};
29
30static int __init qemu_platform_devinit(void)
31{
32 platform_device_register(&pcspeaker_pdev);
33
34 return 0;
35}
36
37device_initcall(qemu_platform_devinit);
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index 416f397c768b..e5f12cf96e8e 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -76,6 +76,11 @@ static struct platform_device pcit_cmos_device = {
76 .resource = pcit_cmos_rsrc 76 .resource = pcit_cmos_rsrc
77}; 77};
78 78
79static struct platform_device pcit_pcspeaker_pdev = {
80 .name = "pcspkr",
81 .id = -1,
82};
83
79static struct resource sni_io_resource = { 84static struct resource sni_io_resource = {
80 .start = 0x00000000UL, 85 .start = 0x00000000UL,
81 .end = 0x03bfffffUL, 86 .end = 0x03bfffffUL,
@@ -277,11 +282,13 @@ static int __init snirm_pcit_setup_devinit(void)
277 case SNI_BRD_PCI_TOWER: 282 case SNI_BRD_PCI_TOWER:
278 platform_device_register(&pcit_serial8250_device); 283 platform_device_register(&pcit_serial8250_device);
279 platform_device_register(&pcit_cmos_device); 284 platform_device_register(&pcit_cmos_device);
285 platform_device_register(&pcit_pcspeaker_pdev);
280 break; 286 break;
281 287
282 case SNI_BRD_PCI_TOWER_CPLUS: 288 case SNI_BRD_PCI_TOWER_CPLUS:
283 platform_device_register(&pcit_cplus_serial8250_device); 289 platform_device_register(&pcit_cplus_serial8250_device);
284 platform_device_register(&pcit_cmos_device); 290 platform_device_register(&pcit_cmos_device);
291 platform_device_register(&pcit_pcspeaker_pdev);
285 break; 292 break;
286 } 293 }
287 return 0; 294 return 0;