aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/sparcspkr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc/sparcspkr.c')
-rw-r--r--drivers/input/misc/sparcspkr.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index cdc3fb3d5f46..29d97b12be7a 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);