diff options
author | Stas Sergeev <stsp@aknet.ru> | 2008-03-06 05:01:16 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:21 -0400 |
commit | 52337310af443278ee84ec4b9adaee0037cc0e30 (patch) | |
tree | d0fc387f2584061df602f76f6f6b1daec540e66a /sound/drivers | |
parent | 8280823668d42ed9695da759047b86074ad14ba4 (diff) |
[ALSA] pcsp: improve "enable" option handling
Simplify init code.
Signed-off-by: Stas Sergeev <stsp@aknet.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers')
-rw-r--r-- | sound/drivers/pcsp/pcsp.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index 264d2a56dcd2..547005cb0942 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -31,7 +31,7 @@ MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); | |||
31 | module_param(id, charp, 0444); | 31 | module_param(id, charp, 0444); |
32 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); | 32 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); |
33 | module_param(enable, bool, 0444); | 33 | module_param(enable, bool, 0444); |
34 | MODULE_PARM_DESC(enable, "dummy"); | 34 | MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); |
35 | 35 | ||
36 | struct snd_pcsp pcsp_chip; | 36 | struct snd_pcsp pcsp_chip; |
37 | 37 | ||
@@ -136,7 +136,13 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) | |||
136 | 136 | ||
137 | static int __devinit alsa_card_pcsp_init(struct device *dev) | 137 | static int __devinit alsa_card_pcsp_init(struct device *dev) |
138 | { | 138 | { |
139 | int devnum = 0, cards = 0; | 139 | int err; |
140 | |||
141 | err = snd_card_pcsp_probe(0, dev); | ||
142 | if (err) { | ||
143 | printk(KERN_ERR "PC-Speaker initialization failed.\n"); | ||
144 | return err; | ||
145 | } | ||
140 | 146 | ||
141 | #ifdef CONFIG_DEBUG_PAGEALLOC | 147 | #ifdef CONFIG_DEBUG_PAGEALLOC |
142 | /* Well, CONFIG_DEBUG_PAGEALLOC makes the sound horrible. Lets alert */ | 148 | /* Well, CONFIG_DEBUG_PAGEALLOC makes the sound horrible. Lets alert */ |
@@ -148,15 +154,6 @@ static int __devinit alsa_card_pcsp_init(struct device *dev) | |||
148 | "and crackling noise.\n"); | 154 | "and crackling noise.\n"); |
149 | #endif | 155 | #endif |
150 | 156 | ||
151 | if (enable) { | ||
152 | if (snd_card_pcsp_probe(devnum, dev) >= 0) | ||
153 | cards++; | ||
154 | if (!cards) { | ||
155 | printk(KERN_ERR "PC-Speaker initialization failed.\n"); | ||
156 | return -ENODEV; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | return 0; | 157 | return 0; |
161 | } | 158 | } |
162 | 159 | ||
@@ -168,6 +165,7 @@ static void __devexit alsa_card_pcsp_exit(struct snd_pcsp *chip) | |||
168 | static int __devinit pcsp_probe(struct platform_device *dev) | 165 | static int __devinit pcsp_probe(struct platform_device *dev) |
169 | { | 166 | { |
170 | int err; | 167 | int err; |
168 | |||
171 | err = pcspkr_input_init(&pcsp_chip.input_dev, &dev->dev); | 169 | err = pcspkr_input_init(&pcsp_chip.input_dev, &dev->dev); |
172 | if (err < 0) | 170 | if (err < 0) |
173 | return err; | 171 | return err; |
@@ -227,6 +225,8 @@ static struct platform_driver pcsp_platform_driver = { | |||
227 | 225 | ||
228 | static int __init pcsp_init(void) | 226 | static int __init pcsp_init(void) |
229 | { | 227 | { |
228 | if (!enable) | ||
229 | return -ENODEV; | ||
230 | return platform_driver_register(&pcsp_platform_driver); | 230 | return platform_driver_register(&pcsp_platform_driver); |
231 | } | 231 | } |
232 | 232 | ||