aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/misc/m68kspkr.c36
-rw-r--r--drivers/input/misc/pcspkr.c30
-rw-r--r--drivers/input/misc/sparcspkr.c47
3 files changed, 56 insertions, 57 deletions
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c
index 64abdd98d482..04489ad7702a 100644
--- a/drivers/input/misc/m68kspkr.c
+++ b/drivers/input/misc/m68kspkr.c
@@ -24,9 +24,7 @@ MODULE_AUTHOR("Richard Zidlicky <rz@linux-m68k.org>");
24MODULE_DESCRIPTION("m68k beeper driver"); 24MODULE_DESCRIPTION("m68k beeper driver");
25MODULE_LICENSE("GPL"); 25MODULE_LICENSE("GPL");
26 26
27static char m68kspkr_name[] = "m68k beeper"; 27static struct input_dev *m68kspkr_dev;
28static char m68kspkr_phys[] = "m68k/generic";
29static struct input_dev m68kspkr_dev;
30 28
31static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 29static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
32{ 30{
@@ -51,32 +49,34 @@ static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int
51 49
52static int __init m68kspkr_init(void) 50static int __init m68kspkr_init(void)
53{ 51{
54 if (!mach_beep){ 52 if (!mach_beep) {
55 printk("%s: no lowlevel beep support\n", m68kspkr_name); 53 printk(KERN_INFO "m68kspkr: no lowlevel beep support\n");
56 return -1; 54 return -ENODEV;
57 } 55 }
58 56
59 m68kspkr_dev.evbit[0] = BIT(EV_SND); 57 m68kspkr_dev = input_allocate_device();
60 m68kspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 58 if (!m68kspkr_dev)
61 m68kspkr_dev.event = m68kspkr_event; 59 return -ENOMEM;
62 60
63 m68kspkr_dev.name = m68kspkr_name; 61 m68kspkr_dev->name = "m68k beeper";
64 m68kspkr_dev.phys = m68kspkr_phys; 62 m68kspkr_dev->phys = "m68k/generic";
65 m68kspkr_dev.id.bustype = BUS_HOST; 63 m68kspkr_dev->id.bustype = BUS_HOST;
66 m68kspkr_dev.id.vendor = 0x001f; 64 m68kspkr_dev->id.vendor = 0x001f;
67 m68kspkr_dev.id.product = 0x0001; 65 m68kspkr_dev->id.product = 0x0001;
68 m68kspkr_dev.id.version = 0x0100; 66 m68kspkr_dev->id.version = 0x0100;
69 67
70 input_register_device(&m68kspkr_dev); 68 m68kspkr_dev->evbit[0] = BIT(EV_SND);
69 m68kspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
70 m68kspkr_dev->event = m68kspkr_event;
71 71
72 printk(KERN_INFO "input: %s\n", m68kspkr_name); 72 input_register_device(m68kspkr_dev);
73 73
74 return 0; 74 return 0;
75} 75}
76 76
77static void __exit m68kspkr_exit(void) 77static void __exit m68kspkr_exit(void)
78{ 78{
79 input_unregister_device(&m68kspkr_dev); 79 input_unregister_device(m68kspkr_dev);
80} 80}
81 81
82module_init(m68kspkr_init); 82module_init(m68kspkr_init);
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 3013194f462b..e34633c37fdd 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -23,9 +23,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
23MODULE_DESCRIPTION("PC Speaker beeper driver"); 23MODULE_DESCRIPTION("PC Speaker beeper driver");
24MODULE_LICENSE("GPL"); 24MODULE_LICENSE("GPL");
25 25
26static char pcspkr_name[] = "PC Speaker"; 26static struct input_dev *pcspkr_dev;
27static char pcspkr_phys[] = "isa0061/input0";
28static struct input_dev pcspkr_dev;
29 27
30static DEFINE_SPINLOCK(i8253_beep_lock); 28static DEFINE_SPINLOCK(i8253_beep_lock);
31 29
@@ -68,27 +66,29 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
68 66
69static int __init pcspkr_init(void) 67static int __init pcspkr_init(void)
70{ 68{
71 pcspkr_dev.evbit[0] = BIT(EV_SND); 69 pcspkr_dev = input_allocate_device();
72 pcspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 70 if (!pcspkr_dev)
73 pcspkr_dev.event = pcspkr_event; 71 return -ENOMEM;
74 72
75 pcspkr_dev.name = pcspkr_name; 73 pcspkr_dev->name = "PC Speaker";
76 pcspkr_dev.phys = pcspkr_phys; 74 pcspkr_dev->name = "isa0061/input0";
77 pcspkr_dev.id.bustype = BUS_ISA; 75 pcspkr_dev->id.bustype = BUS_ISA;
78 pcspkr_dev.id.vendor = 0x001f; 76 pcspkr_dev->id.vendor = 0x001f;
79 pcspkr_dev.id.product = 0x0001; 77 pcspkr_dev->id.product = 0x0001;
80 pcspkr_dev.id.version = 0x0100; 78 pcspkr_dev->id.version = 0x0100;
81 79
82 input_register_device(&pcspkr_dev); 80 pcspkr_dev->evbit[0] = BIT(EV_SND);
81 pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
82 pcspkr_dev->event = pcspkr_event;
83 83
84 printk(KERN_INFO "input: %s\n", pcspkr_name); 84 input_register_device(pcspkr_dev);
85 85
86 return 0; 86 return 0;
87} 87}
88 88
89static void __exit pcspkr_exit(void) 89static void __exit pcspkr_exit(void)
90{ 90{
91 input_unregister_device(&pcspkr_dev); 91 input_unregister_device(pcspkr_dev);
92 /* turn off the speaker */ 92 /* turn off the speaker */
93 pcspkr_event(NULL, EV_SND, SND_BELL, 0); 93 pcspkr_event(NULL, EV_SND, SND_BELL, 0);
94} 94}
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index cdc3fb3d5f46..5778220a18d2 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -17,28 +17,24 @@
17#endif 17#endif
18 18
19MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); 19MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
20MODULE_DESCRIPTION("PC Speaker beeper driver"); 20MODULE_DESCRIPTION("Sparc Speaker beeper driver");
21MODULE_LICENSE("GPL"); 21MODULE_LICENSE("GPL");
22 22
23static unsigned long beep_iobase; 23static unsigned long beep_iobase;
24 24static struct input_dev *sparcspkr_dev;
25static char *sparcspkr_isa_name = "Sparc ISA Speaker";
26static char *sparcspkr_ebus_name = "Sparc EBUS Speaker";
27static char *sparcspkr_phys = "sparc/input0";
28static struct input_dev sparcspkr_dev;
29 25
30DEFINE_SPINLOCK(beep_lock); 26DEFINE_SPINLOCK(beep_lock);
31 27
32static void __init init_sparcspkr_struct(void) 28static void __init init_sparcspkr_struct(void)
33{ 29{
34 sparcspkr_dev.evbit[0] = BIT(EV_SND); 30 sparcspkr_dev->evbit[0] = BIT(EV_SND);
35 sparcspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 31 sparcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
36 32
37 sparcspkr_dev.phys = sparcspkr_phys; 33 sparcspkr_dev->phys = "sparc/input0";
38 sparcspkr_dev.id.bustype = BUS_ISA; 34 sparcspkr_dev->id.bustype = BUS_ISA;
39 sparcspkr_dev.id.vendor = 0x001f; 35 sparcspkr_dev->id.vendor = 0x001f;
40 sparcspkr_dev.id.product = 0x0001; 36 sparcspkr_dev->id.product = 0x0001;
41 sparcspkr_dev.id.version = 0x0100; 37 sparcspkr_dev->id.version = 0x0100;
42} 38}
43 39
44static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 40static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
@@ -84,14 +80,15 @@ static int __init init_ebus_beep(struct linux_ebus_device *edev)
84{ 80{
85 beep_iobase = edev->resource[0].start; 81 beep_iobase = edev->resource[0].start;
86 82
87 init_sparcspkr_struct(); 83 sparcspkr_dev = input_allocate_device();
84 if (!sparcspkr_dev)
85 return -ENOMEM;
88 86
89 sparcspkr_dev.name = sparcspkr_ebus_name; 87 sparcspkr_dev->name = "Sparc EBUS Speaker";
90 sparcspkr_dev.event = ebus_spkr_event; 88 sparcspkr_dev->event = ebus_spkr_event;
91 89
92 input_register_device(&sparcspkr_dev); 90 input_register_device(sparcspkr_dev);
93 91
94 printk(KERN_INFO "input: %s\n", sparcspkr_ebus_name);
95 return 0; 92 return 0;
96} 93}
97 94
@@ -137,15 +134,17 @@ static int __init init_isa_beep(struct sparc_isa_device *isa_dev)
137{ 134{
138 beep_iobase = isa_dev->resource.start; 135 beep_iobase = isa_dev->resource.start;
139 136
137 sparcspkr_dev = input_allocate_device();
138 if (!sparcspkr_dev)
139 return -ENOMEM;
140
140 init_sparcspkr_struct(); 141 init_sparcspkr_struct();
141 142
142 sparcspkr_dev.name = sparcspkr_isa_name; 143 sparcspkr_dev->name = "Sparc ISA Speaker";
143 sparcspkr_dev.event = isa_spkr_event; 144 sparcspkr_dev->event = isa_spkr_event;
144 sparcspkr_dev.id.bustype = BUS_ISA;
145 145
146 input_register_device(&sparcspkr_dev); 146 input_register_device(&sparcspkr_dev);
147 147
148 printk(KERN_INFO "input: %s\n", sparcspkr_isa_name);
149 return 0; 148 return 0;
150} 149}
151#endif 150#endif
@@ -182,7 +181,7 @@ static int __init sparcspkr_init(void)
182 181
183static void __exit sparcspkr_exit(void) 182static void __exit sparcspkr_exit(void)
184{ 183{
185 input_unregister_device(&sparcspkr_dev); 184 input_unregister_device(sparcspkr_dev);
186} 185}
187 186
188module_init(sparcspkr_init); 187module_init(sparcspkr_init);