aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-03-28 21:24:50 -0500
committerPaul Mackerras <paulus@samba.org>2006-03-28 21:24:50 -0500
commitbac30d1a78d0f11c613968fc8b351a91ed465386 (patch)
treee52f3c876522a2f6047a6ec1c27df2e8a79486b8 /sound
parente8222502ee6157e2713da9e0792c21f4ad458d50 (diff)
parentca9ba4471c1203bb6e759b76e83167fec54fe590 (diff)
Merge ../linux-2.6
Diffstat (limited to 'sound')
-rw-r--r--sound/core/init.c3
-rw-r--r--sound/core/rawmidi.c6
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c2
-rw-r--r--sound/drivers/mpu401/mpu401.c16
-rw-r--r--sound/isa/ad1816a/ad1816a.c12
-rw-r--r--sound/isa/als100.c14
-rw-r--r--sound/isa/azt2320.c12
-rw-r--r--sound/isa/cmi8330.c15
-rw-r--r--sound/isa/cs423x/cs4236.c25
-rw-r--r--sound/isa/dt019x.c12
-rw-r--r--sound/isa/es18xx.c13
-rw-r--r--sound/isa/gus/interwave.c12
-rw-r--r--sound/isa/opl3sa2.c17
-rw-r--r--sound/isa/sb/es968.c12
-rw-r--r--sound/isa/sb/sb16.c14
-rw-r--r--sound/isa/sscape.c4
-rw-r--r--sound/isa/wavefront/wavefront.c10
-rw-r--r--sound/oss/cs4232.c15
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c2
-rw-r--r--sound/oss/emu10k1/midi.c9
-rw-r--r--sound/oss/esssolo1.c2
-rw-r--r--sound/oss/maestro3.c10
-rw-r--r--sound/oss/msnd.c6
-rw-r--r--sound/oss/sb_card.c35
-rw-r--r--sound/oss/sequencer.c13
-rw-r--r--sound/oss/sh_dac_audio.c2
-rw-r--r--sound/oss/sonicvibes.c3
-rw-r--r--sound/pci/ad1889.c1
-rw-r--r--sound/pci/ali5451/ali5451.c5
-rw-r--r--sound/pci/als4000.c5
-rw-r--r--sound/pci/azt3328.c5
-rw-r--r--sound/pci/emu10k1/emu10k1x.c1
-rw-r--r--sound/pci/es1938.c5
-rw-r--r--sound/pci/es1968.c1
-rw-r--r--sound/pci/ice1712/ice1712.c2
-rw-r--r--sound/pci/maestro3.c1
-rw-r--r--sound/pci/mixart/mixart.c2
-rw-r--r--sound/pci/pcxhr/pcxhr.c1
-rw-r--r--sound/pci/rme32.c8
-rw-r--r--sound/pci/rme96.c8
-rw-r--r--sound/pci/rme9652/hdspm.c2
-rw-r--r--sound/pci/sonicvibes.c5
-rw-r--r--sound/pci/trident/trident_main.c5
-rw-r--r--sound/sound_core.c22
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c2
46 files changed, 221 insertions, 160 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index ad68761abba1..5bb8a8b23d51 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card)
223 struct snd_monitor_file *mfile; 223 struct snd_monitor_file *mfile;
224 struct file *file; 224 struct file *file;
225 struct snd_shutdown_f_ops *s_f_ops; 225 struct snd_shutdown_f_ops *s_f_ops;
226 struct file_operations *f_ops, *old_f_ops; 226 struct file_operations *f_ops;
227 const struct file_operations *old_f_ops;
227 int err; 228 int err;
228 229
229 spin_lock(&card->files_lock); 230 spin_lock(&card->files_lock);
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 6b7a36774298..87b47c9564f7 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -631,7 +631,8 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
631 return -EINVAL; 631 return -EINVAL;
632 } 632 }
633 if (params->buffer_size != runtime->buffer_size) { 633 if (params->buffer_size != runtime->buffer_size) {
634 if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) 634 newbuf = kmalloc(params->buffer_size, GFP_KERNEL);
635 if (!newbuf)
635 return -ENOMEM; 636 return -ENOMEM;
636 kfree(runtime->buffer); 637 kfree(runtime->buffer);
637 runtime->buffer = newbuf; 638 runtime->buffer = newbuf;
@@ -657,7 +658,8 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
657 return -EINVAL; 658 return -EINVAL;
658 } 659 }
659 if (params->buffer_size != runtime->buffer_size) { 660 if (params->buffer_size != runtime->buffer_size) {
660 if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) 661 newbuf = kmalloc(params->buffer_size, GFP_KERNEL);
662 if (!newbuf)
661 return -ENOMEM; 663 return -ENOMEM;
662 kfree(runtime->buffer); 664 kfree(runtime->buffer);
663 runtime->buffer = newbuf; 665 runtime->buffer = newbuf;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 4d28e5212611..108e430b5036 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -137,7 +137,7 @@ static int snd_open(struct inode *inode, struct file *file)
137{ 137{
138 unsigned int minor = iminor(inode); 138 unsigned int minor = iminor(inode);
139 struct snd_minor *mptr = NULL; 139 struct snd_minor *mptr = NULL;
140 struct file_operations *old_fops; 140 const struct file_operations *old_fops;
141 int err = 0; 141 int err = 0;
142 142
143 if (minor >= ARRAY_SIZE(snd_minors)) 143 if (minor >= ARRAY_SIZE(snd_minors))
@@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
240 * Retrurns zero if successful, or a negative error code on failure. 240 * Retrurns zero if successful, or a negative error code on failure.
241 */ 241 */
242int snd_register_device(int type, struct snd_card *card, int dev, 242int snd_register_device(int type, struct snd_card *card, int dev,
243 struct file_operations *f_ops, void *private_data, 243 const struct file_operations *f_ops, void *private_data,
244 const char *name) 244 const char *name)
245{ 245{
246 int minor; 246 int minor;
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 4023d3b406de..9055c6de9587 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -95,7 +95,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
95} 95}
96 96
97int snd_register_oss_device(int type, struct snd_card *card, int dev, 97int snd_register_oss_device(int type, struct snd_card *card, int dev,
98 struct file_operations *f_ops, void *private_data, 98 const struct file_operations *f_ops, void *private_data,
99 const char *name) 99 const char *name)
100{ 100{
101 int minor = snd_oss_kernel_minor(type, card, dev); 101 int minor = snd_oss_kernel_minor(type, card, dev);
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index 9d10d79e27af..9ea3059a7064 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -59,7 +59,8 @@ module_param_array(irq, int, NULL, 0444);
59MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); 59MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
60 60
61static struct platform_device *platform_devices[SNDRV_CARDS]; 61static struct platform_device *platform_devices[SNDRV_CARDS];
62static int pnp_registered = 0; 62static int pnp_registered;
63static unsigned int snd_mpu401_devices;
63 64
64static int snd_mpu401_create(int dev, struct snd_card **rcard) 65static int snd_mpu401_create(int dev, struct snd_card **rcard)
65{ 66{
@@ -197,6 +198,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
197 } 198 }
198 snd_card_set_dev(card, &pnp_dev->dev); 199 snd_card_set_dev(card, &pnp_dev->dev);
199 pnp_set_drvdata(pnp_dev, card); 200 pnp_set_drvdata(pnp_dev, card);
201 snd_mpu401_devices++;
200 ++dev; 202 ++dev;
201 return 0; 203 return 0;
202 } 204 }
@@ -234,12 +236,11 @@ static void __init_or_module snd_mpu401_unregister_all(void)
234 236
235static int __init alsa_card_mpu401_init(void) 237static int __init alsa_card_mpu401_init(void)
236{ 238{
237 int i, err, devices; 239 int i, err;
238 240
239 if ((err = platform_driver_register(&snd_mpu401_driver)) < 0) 241 if ((err = platform_driver_register(&snd_mpu401_driver)) < 0)
240 return err; 242 return err;
241 243
242 devices = 0;
243 for (i = 0; i < SNDRV_CARDS; i++) { 244 for (i = 0; i < SNDRV_CARDS; i++) {
244 struct platform_device *device; 245 struct platform_device *device;
245 if (! enable[i]) 246 if (! enable[i])
@@ -255,14 +256,13 @@ static int __init alsa_card_mpu401_init(void)
255 goto errout; 256 goto errout;
256 } 257 }
257 platform_devices[i] = device; 258 platform_devices[i] = device;
258 devices++; 259 snd_mpu401_devices++;
259 } 260 }
260 if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) { 261 err = pnp_register_driver(&snd_mpu401_pnp_driver);
262 if (!err)
261 pnp_registered = 1; 263 pnp_registered = 1;
262 devices += err;
263 }
264 264
265 if (!devices) { 265 if (!snd_mpu401_devices) {
266#ifdef MODULE 266#ifdef MODULE
267 printk(KERN_ERR "MPU-401 device not found or device busy\n"); 267 printk(KERN_ERR "MPU-401 device not found or device busy\n");
268#endif 268#endif
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 7051f7798ed7..31f299aed281 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -262,6 +262,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
262 return 0; 262 return 0;
263} 263}
264 264
265static unsigned int __devinitdata ad1816a_devices;
266
265static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, 267static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card,
266 const struct pnp_card_device_id *id) 268 const struct pnp_card_device_id *id)
267{ 269{
@@ -275,6 +277,7 @@ static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card,
275 if (res < 0) 277 if (res < 0)
276 return res; 278 return res;
277 dev++; 279 dev++;
280 ad1816a_devices++;
278 return 0; 281 return 0;
279 } 282 }
280 return -ENODEV; 283 return -ENODEV;
@@ -297,10 +300,13 @@ static struct pnp_card_driver ad1816a_pnpc_driver = {
297 300
298static int __init alsa_card_ad1816a_init(void) 301static int __init alsa_card_ad1816a_init(void)
299{ 302{
300 int cards; 303 int err;
304
305 err = pnp_register_card_driver(&ad1816a_pnpc_driver);
306 if (err)
307 return err;
301 308
302 cards = pnp_register_card_driver(&ad1816a_pnpc_driver); 309 if (!ad1816a_devices) {
303 if (cards <= 0) {
304 pnp_unregister_card_driver(&ad1816a_pnpc_driver); 310 pnp_unregister_card_driver(&ad1816a_pnpc_driver);
305#ifdef MODULE 311#ifdef MODULE
306 printk(KERN_ERR "no AD1816A based soundcards found.\n"); 312 printk(KERN_ERR "no AD1816A based soundcards found.\n");
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index 9b77c17b3f66..a52bd8a14c9b 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -199,7 +199,7 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
199 return 0; 199 return 0;
200} 200}
201 201
202static int __init snd_card_als100_probe(int dev, 202static int __devinit snd_card_als100_probe(int dev,
203 struct pnp_card_link *pcard, 203 struct pnp_card_link *pcard,
204 const struct pnp_card_device_id *pid) 204 const struct pnp_card_device_id *pid)
205{ 205{
@@ -281,6 +281,8 @@ static int __init snd_card_als100_probe(int dev,
281 return 0; 281 return 0;
282} 282}
283 283
284static unsigned int __devinitdata als100_devices;
285
284static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, 286static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card,
285 const struct pnp_card_device_id *id) 287 const struct pnp_card_device_id *id)
286{ 288{
@@ -294,6 +296,7 @@ static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card,
294 if (res < 0) 296 if (res < 0)
295 return res; 297 return res;
296 dev++; 298 dev++;
299 als100_devices++;
297 return 0; 300 return 0;
298 } 301 }
299 return -ENODEV; 302 return -ENODEV;
@@ -345,10 +348,13 @@ static struct pnp_card_driver als100_pnpc_driver = {
345 348
346static int __init alsa_card_als100_init(void) 349static int __init alsa_card_als100_init(void)
347{ 350{
348 int cards; 351 int err;
352
353 err = pnp_register_card_driver(&als100_pnpc_driver);
354 if (err)
355 return err;
349 356
350 cards = pnp_register_card_driver(&als100_pnpc_driver); 357 if (!als100_devices) {
351 if (cards <= 0) {
352 pnp_unregister_card_driver(&als100_pnpc_driver); 358 pnp_unregister_card_driver(&als100_pnpc_driver);
353#ifdef MODULE 359#ifdef MODULE
354 snd_printk(KERN_ERR "no ALS100 based soundcards found\n"); 360 snd_printk(KERN_ERR "no ALS100 based soundcards found\n");
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index a530691bf4f7..15e59283aac6 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -310,6 +310,8 @@ static int __devinit snd_card_azt2320_probe(int dev,
310 return 0; 310 return 0;
311} 311}
312 312
313static unsigned int __devinitdata azt2320_devices;
314
313static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, 315static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
314 const struct pnp_card_device_id *id) 316 const struct pnp_card_device_id *id)
315{ 317{
@@ -323,6 +325,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
323 if (res < 0) 325 if (res < 0)
324 return res; 326 return res;
325 dev++; 327 dev++;
328 azt2320_devices++;
326 return 0; 329 return 0;
327 } 330 }
328 return -ENODEV; 331 return -ENODEV;
@@ -372,10 +375,13 @@ static struct pnp_card_driver azt2320_pnpc_driver = {
372 375
373static int __init alsa_card_azt2320_init(void) 376static int __init alsa_card_azt2320_init(void)
374{ 377{
375 int cards; 378 int err;
379
380 err = pnp_register_card_driver(&azt2320_pnpc_driver);
381 if (err)
382 return err;
376 383
377 cards = pnp_register_card_driver(&azt2320_pnpc_driver); 384 if (!azt2320_devices) {
378 if (cards <= 0) {
379 pnp_unregister_card_driver(&azt2320_pnpc_driver); 385 pnp_unregister_card_driver(&azt2320_pnpc_driver);
380#ifdef MODULE 386#ifdef MODULE
381 snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); 387 snd_printk(KERN_ERR "no AZT2320 based soundcards found\n");
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index fd9bb2575de8..fa63048a8b9d 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -175,7 +175,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids);
175#endif 175#endif
176 176
177 177
178static struct ad1848_mix_elem snd_cmi8330_controls[] __initdata = { 178static struct ad1848_mix_elem snd_cmi8330_controls[] __devinitdata = {
179AD1848_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), 179AD1848_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0),
180AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1), 180AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1),
181AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1), 181AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1),
@@ -204,7 +204,7 @@ AD1848_SINGLE(SNDRV_CTL_NAME_IEC958("Input ",PLAYBACK,SWITCH), 0, CMI8330_MUTEMU
204}; 204};
205 205
206#ifdef ENABLE_SB_MIXER 206#ifdef ENABLE_SB_MIXER
207static struct sbmix_elem cmi8330_sb_mixers[] __initdata = { 207static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = {
208SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), 208SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
209SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), 209SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15),
210SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), 210SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15),
@@ -222,7 +222,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6
222SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), 222SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1),
223}; 223};
224 224
225static unsigned char cmi8330_sb_init_values[][2] __initdata = { 225static unsigned char cmi8330_sb_init_values[][2] __devinitdata = {
226 { SB_DSP4_MASTER_DEV + 0, 0 }, 226 { SB_DSP4_MASTER_DEV + 0, 0 },
227 { SB_DSP4_MASTER_DEV + 1, 0 }, 227 { SB_DSP4_MASTER_DEV + 1, 0 },
228 { SB_DSP4_PCM_DEV + 0, 0 }, 228 { SB_DSP4_PCM_DEV + 0, 0 },
@@ -545,7 +545,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
545 return snd_card_register(card); 545 return snd_card_register(card);
546} 546}
547 547
548static int __init snd_cmi8330_nonpnp_probe(struct platform_device *pdev) 548static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev)
549{ 549{
550 struct snd_card *card; 550 struct snd_card *card;
551 int err; 551 int err;
@@ -607,6 +607,8 @@ static struct platform_driver snd_cmi8330_driver = {
607 607
608 608
609#ifdef CONFIG_PNP 609#ifdef CONFIG_PNP
610static unsigned int __devinitdata cmi8330_pnp_devices;
611
610static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, 612static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
611 const struct pnp_card_device_id *pid) 613 const struct pnp_card_device_id *pid)
612{ 614{
@@ -636,6 +638,7 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
636 } 638 }
637 pnp_set_card_drvdata(pcard, card); 639 pnp_set_card_drvdata(pcard, card);
638 dev++; 640 dev++;
641 cmi8330_pnp_devices++;
639 return 0; 642 return 0;
640} 643}
641 644
@@ -706,9 +709,9 @@ static int __init alsa_card_cmi8330_init(void)
706 709
707#ifdef CONFIG_PNP 710#ifdef CONFIG_PNP
708 err = pnp_register_card_driver(&cmi8330_pnpc_driver); 711 err = pnp_register_card_driver(&cmi8330_pnpc_driver);
709 if (err >= 0) { 712 if (!err) {
710 pnp_registered = 1; 713 pnp_registered = 1;
711 cards += err; 714 cards += cmi8330_pnp_devices;
712 } 715 }
713#endif 716#endif
714 717
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 4060918e0327..382bb17ef49f 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -133,6 +133,7 @@ static int pnpc_registered;
133static int pnp_registered; 133static int pnp_registered;
134#endif 134#endif
135#endif /* CONFIG_PNP */ 135#endif /* CONFIG_PNP */
136static unsigned int snd_cs423x_devices;
136 137
137struct snd_card_cs4236 { 138struct snd_card_cs4236 {
138 struct snd_cs4231 *chip; 139 struct snd_cs4231 *chip;
@@ -564,7 +565,7 @@ static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev)
564 snd_card_free(card); 565 snd_card_free(card);
565 return err; 566 return err;
566 } 567 }
567 568
568 platform_set_drvdata(pdev, card); 569 platform_set_drvdata(pdev, card);
569 return 0; 570 return 0;
570} 571}
@@ -650,6 +651,7 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev,
650 } 651 }
651 pnp_set_drvdata(pdev, card); 652 pnp_set_drvdata(pdev, card);
652 dev++; 653 dev++;
654 snd_cs423x_devices++;
653 return 0; 655 return 0;
654} 656}
655 657
@@ -713,6 +715,7 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
713 } 715 }
714 pnp_set_card_drvdata(pcard, card); 716 pnp_set_card_drvdata(pcard, card);
715 dev++; 717 dev++;
718 snd_cs423x_devices++;
716 return 0; 719 return 0;
717} 720}
718 721
@@ -721,7 +724,7 @@ static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link * pcard)
721 snd_card_free(pnp_get_card_drvdata(pcard)); 724 snd_card_free(pnp_get_card_drvdata(pcard));
722 pnp_set_card_drvdata(pcard, NULL); 725 pnp_set_card_drvdata(pcard, NULL);
723} 726}
724 727
725#ifdef CONFIG_PM 728#ifdef CONFIG_PM
726static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state) 729static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state)
727{ 730{
@@ -766,7 +769,7 @@ static void __init_or_module snd_cs423x_unregister_all(void)
766 769
767static int __init alsa_card_cs423x_init(void) 770static int __init alsa_card_cs423x_init(void)
768{ 771{
769 int i, err, cards = 0; 772 int i, err;
770 773
771 if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) 774 if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0)
772 return err; 775 return err;
@@ -782,24 +785,20 @@ static int __init alsa_card_cs423x_init(void)
782 goto errout; 785 goto errout;
783 } 786 }
784 platform_devices[i] = device; 787 platform_devices[i] = device;
785 cards++; 788 snd_cs423x_devices++;
786 } 789 }
787#ifdef CONFIG_PNP 790#ifdef CONFIG_PNP
788#ifdef CS4232 791#ifdef CS4232
789 i = pnp_register_driver(&cs4232_pnp_driver); 792 err = pnp_register_driver(&cs4232_pnp_driver);
790 if (i >= 0) { 793 if (!err)
791 pnp_registered = 1; 794 pnp_registered = 1;
792 cards += i;
793 }
794#endif 795#endif
795 i = pnp_register_card_driver(&cs423x_pnpc_driver); 796 err = pnp_register_card_driver(&cs423x_pnpc_driver);
796 if (i >= 0) { 797 if (!err)
797 pnpc_registered = 1; 798 pnpc_registered = 1;
798 cards += i;
799 }
800#endif /* CONFIG_PNP */ 799#endif /* CONFIG_PNP */
801 800
802 if (!cards) { 801 if (!snd_cs423x_devices) {
803#ifdef MODULE 802#ifdef MODULE
804 printk(KERN_ERR IDENT " soundcard not found or device busy\n"); 803 printk(KERN_ERR IDENT " soundcard not found or device busy\n");
805#endif 804#endif
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index 50e7bc5ef561..0acb4e5da47f 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -272,6 +272,8 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard,
272 return 0; 272 return 0;
273} 273}
274 274
275static unsigned int __devinitdata dt019x_devices;
276
275static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, 277static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card,
276 const struct pnp_card_device_id *pid) 278 const struct pnp_card_device_id *pid)
277{ 279{
@@ -285,6 +287,7 @@ static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card,
285 if (res < 0) 287 if (res < 0)
286 return res; 288 return res;
287 dev++; 289 dev++;
290 dt019x_devices++;
288 return 0; 291 return 0;
289 } 292 }
290 return -ENODEV; 293 return -ENODEV;
@@ -336,10 +339,13 @@ static struct pnp_card_driver dt019x_pnpc_driver = {
336 339
337static int __init alsa_card_dt019x_init(void) 340static int __init alsa_card_dt019x_init(void)
338{ 341{
339 int cards = 0; 342 int err;
343
344 err = pnp_register_card_driver(&dt019x_pnpc_driver);
345 if (err)
346 return err;
340 347
341 cards = pnp_register_card_driver(&dt019x_pnpc_driver); 348 if (!dt019x_devices) {
342 if (cards <= 0) {
343 pnp_unregister_card_driver(&dt019x_pnpc_driver); 349 pnp_unregister_card_driver(&dt019x_pnpc_driver);
344#ifdef MODULE 350#ifdef MODULE
345 snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n"); 351 snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n");
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 721955d26194..9fbc185b4cc2 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2204,7 +2204,7 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
2204 return snd_card_register(card); 2204 return snd_card_register(card);
2205} 2205}
2206 2206
2207static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) 2207static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr)
2208{ 2208{
2209 struct snd_card *card; 2209 struct snd_card *card;
2210 int err; 2210 int err;
@@ -2221,7 +2221,7 @@ static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devp
2221 return 0; 2221 return 0;
2222} 2222}
2223 2223
2224static int __init snd_es18xx_nonpnp_probe(struct platform_device *pdev) 2224static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev)
2225{ 2225{
2226 int dev = pdev->id; 2226 int dev = pdev->id;
2227 int err; 2227 int err;
@@ -2297,6 +2297,8 @@ static struct platform_driver snd_es18xx_nonpnp_driver = {
2297 2297
2298 2298
2299#ifdef CONFIG_PNP 2299#ifdef CONFIG_PNP
2300static unsigned int __devinitdata es18xx_pnp_devices;
2301
2300static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, 2302static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard,
2301 const struct pnp_card_device_id *pid) 2303 const struct pnp_card_device_id *pid)
2302{ 2304{
@@ -2327,6 +2329,7 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard,
2327 2329
2328 pnp_set_card_drvdata(pcard, card); 2330 pnp_set_card_drvdata(pcard, card);
2329 dev++; 2331 dev++;
2332 es18xx_pnp_devices++;
2330 return 0; 2333 return 0;
2331} 2334}
2332 2335
@@ -2397,10 +2400,10 @@ static int __init alsa_card_es18xx_init(void)
2397 } 2400 }
2398 2401
2399#ifdef CONFIG_PNP 2402#ifdef CONFIG_PNP
2400 i = pnp_register_card_driver(&es18xx_pnpc_driver); 2403 err = pnp_register_card_driver(&es18xx_pnpc_driver);
2401 if (i >= 0) { 2404 if (!err) {
2402 pnp_registered = 1; 2405 pnp_registered = 1;
2403 cards += i; 2406 cards += es18xx_pnp_devices;
2404 } 2407 }
2405#endif 2408#endif
2406 2409
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 2cacd0fa6871..de71b7a99c83 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -791,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
791 return 0; 791 return 0;
792} 792}
793 793
794static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) 794static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr)
795{ 795{
796 struct snd_card *card; 796 struct snd_card *card;
797 int err; 797 int err;
@@ -809,7 +809,7 @@ static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *d
809 return 0; 809 return 0;
810} 810}
811 811
812static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev) 812static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev)
813{ 813{
814 int dev = pdev->id; 814 int dev = pdev->id;
815 int err; 815 int err;
@@ -867,6 +867,7 @@ static struct platform_driver snd_interwave_driver = {
867}; 867};
868 868
869#ifdef CONFIG_PNP 869#ifdef CONFIG_PNP
870static unsigned int __devinitdata interwave_pnp_devices;
870 871
871static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, 872static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
872 const struct pnp_card_device_id *pid) 873 const struct pnp_card_device_id *pid)
@@ -897,6 +898,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
897 } 898 }
898 pnp_set_card_drvdata(pcard, card); 899 pnp_set_card_drvdata(pcard, card);
899 dev++; 900 dev++;
901 interwave_pnp_devices++;
900 return 0; 902 return 0;
901} 903}
902 904
@@ -954,10 +956,10 @@ static int __init alsa_card_interwave_init(void)
954 } 956 }
955 957
956 /* ISA PnP cards */ 958 /* ISA PnP cards */
957 i = pnp_register_card_driver(&interwave_pnpc_driver); 959 err = pnp_register_card_driver(&interwave_pnpc_driver);
958 if (i >= 0) { 960 if (!err) {
959 pnp_registered = 1; 961 pnp_registered = 1;
960 cards += i; 962 cards += interwave_pnp_devices;;
961 } 963 }
962 964
963 if (!cards) { 965 if (!cards) {
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 56fcd8a946a4..c906e205d7d5 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -95,6 +95,7 @@ static struct platform_device *platform_devices[SNDRV_CARDS];
95static int pnp_registered; 95static int pnp_registered;
96static int pnpc_registered; 96static int pnpc_registered;
97#endif 97#endif
98static unsigned int snd_opl3sa2_devices;
98 99
99/* control ports */ 100/* control ports */
100#define OPL3SA2_PM_CTRL 0x01 101#define OPL3SA2_PM_CTRL 0x01
@@ -760,6 +761,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
760 } 761 }
761 pnp_set_drvdata(pdev, card); 762 pnp_set_drvdata(pdev, card);
762 dev++; 763 dev++;
764 snd_opl3sa2_devices++;
763 return 0; 765 return 0;
764} 766}
765 767
@@ -826,6 +828,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
826 } 828 }
827 pnp_set_card_drvdata(pcard, card); 829 pnp_set_card_drvdata(pcard, card);
828 dev++; 830 dev++;
831 snd_opl3sa2_devices++;
829 return 0; 832 return 0;
830} 833}
831 834
@@ -944,7 +947,7 @@ static void __init_or_module snd_opl3sa2_unregister_all(void)
944 947
945static int __init alsa_card_opl3sa2_init(void) 948static int __init alsa_card_opl3sa2_init(void)
946{ 949{
947 int i, err, cards = 0; 950 int i, err;
948 951
949 if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) 952 if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0)
950 return err; 953 return err;
@@ -964,23 +967,19 @@ static int __init alsa_card_opl3sa2_init(void)
964 goto errout; 967 goto errout;
965 } 968 }
966 platform_devices[i] = device; 969 platform_devices[i] = device;
967 cards++; 970 snd_opl3sa2_devices++;
968 } 971 }
969 972
970#ifdef CONFIG_PNP 973#ifdef CONFIG_PNP
971 err = pnp_register_driver(&opl3sa2_pnp_driver); 974 err = pnp_register_driver(&opl3sa2_pnp_driver);
972 if (err >= 0) { 975 if (!err)
973 pnp_registered = 1; 976 pnp_registered = 1;
974 cards += err;
975 }
976 err = pnp_register_card_driver(&opl3sa2_pnpc_driver); 977 err = pnp_register_card_driver(&opl3sa2_pnpc_driver);
977 if (err >= 0) { 978 if (!err)
978 pnpc_registered = 1; 979 pnpc_registered = 1;
979 cards += err;
980 }
981#endif 980#endif
982 981
983 if (!cards) { 982 if (!snd_opl3sa2_devices) {
984#ifdef MODULE 983#ifdef MODULE
985 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); 984 snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n");
986#endif 985#endif
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
index 9da80bfa3027..d4d65b84265a 100644
--- a/sound/isa/sb/es968.c
+++ b/sound/isa/sb/es968.c
@@ -124,7 +124,7 @@ static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard,
124 return 0; 124 return 0;
125} 125}
126 126
127static int __init snd_card_es968_probe(int dev, 127static int __devinit snd_card_es968_probe(int dev,
128 struct pnp_card_link *pcard, 128 struct pnp_card_link *pcard,
129 const struct pnp_card_device_id *pid) 129 const struct pnp_card_device_id *pid)
130{ 130{
@@ -182,6 +182,8 @@ static int __init snd_card_es968_probe(int dev,
182 return 0; 182 return 0;
183} 183}
184 184
185static unsigned int __devinitdata es968_devices;
186
185static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, 187static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card,
186 const struct pnp_card_device_id *id) 188 const struct pnp_card_device_id *id)
187{ 189{
@@ -195,6 +197,7 @@ static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card,
195 if (res < 0) 197 if (res < 0)
196 return res; 198 return res;
197 dev++; 199 dev++;
200 es968_devices++;
198 return 0; 201 return 0;
199 } 202 }
200 return -ENODEV; 203 return -ENODEV;
@@ -246,8 +249,11 @@ static struct pnp_card_driver es968_pnpc_driver = {
246 249
247static int __init alsa_card_es968_init(void) 250static int __init alsa_card_es968_init(void)
248{ 251{
249 int cards = pnp_register_card_driver(&es968_pnpc_driver); 252 int err = pnp_register_card_driver(&es968_pnpc_driver);
250 if (cards <= 0) { 253 if (err)
254 return err;
255
256 if (!es968_devices) {
251 pnp_unregister_card_driver(&es968_pnpc_driver); 257 pnp_unregister_card_driver(&es968_pnpc_driver);
252#ifdef MODULE 258#ifdef MODULE
253 snd_printk(KERN_ERR "no ES968 based soundcards found\n"); 259 snd_printk(KERN_ERR "no ES968 based soundcards found\n");
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 5737ab76160c..21ea65925a9e 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -369,7 +369,7 @@ static struct snd_card *snd_sb16_card_new(int dev)
369 return card; 369 return card;
370} 370}
371 371
372static int __init snd_sb16_probe(struct snd_card *card, int dev) 372static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
373{ 373{
374 int xirq, xdma8, xdma16; 374 int xirq, xdma8, xdma16;
375 struct snd_sb *chip; 375 struct snd_sb *chip;
@@ -518,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card)
518} 518}
519#endif 519#endif
520 520
521static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) 521static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr)
522{ 522{
523 struct snd_card_sb16 *acard; 523 struct snd_card_sb16 *acard;
524 struct snd_card *card; 524 struct snd_card *card;
@@ -548,7 +548,7 @@ static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr
548} 548}
549 549
550 550
551static int __init snd_sb16_nonpnp_probe(struct platform_device *pdev) 551static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev)
552{ 552{
553 int dev = pdev->id; 553 int dev = pdev->id;
554 int err; 554 int err;
@@ -629,6 +629,7 @@ static struct platform_driver snd_sb16_nonpnp_driver = {
629 629
630 630
631#ifdef CONFIG_PNP 631#ifdef CONFIG_PNP
632static unsigned int __devinitdata sb16_pnp_devices;
632 633
633static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, 634static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
634 const struct pnp_card_device_id *pid) 635 const struct pnp_card_device_id *pid)
@@ -651,6 +652,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
651 } 652 }
652 pnp_set_card_drvdata(pcard, card); 653 pnp_set_card_drvdata(pcard, card);
653 dev++; 654 dev++;
655 sb16_pnp_devices++;
654 return 0; 656 return 0;
655 } 657 }
656 658
@@ -727,10 +729,10 @@ static int __init alsa_card_sb16_init(void)
727 } 729 }
728#ifdef CONFIG_PNP 730#ifdef CONFIG_PNP
729 /* PnP cards at last */ 731 /* PnP cards at last */
730 i = pnp_register_card_driver(&sb16_pnpc_driver); 732 err = pnp_register_card_driver(&sb16_pnpc_driver);
731 if (i >= 0) { 733 if (!err) {
732 pnp_registered = 1; 734 pnp_registered = 1;
733 cards += i; 735 cards += sb16_pnp_devices;
734 } 736 }
735#endif 737#endif
736 738
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 29bba8cc3ef3..48e5552d3444 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1255,7 +1255,7 @@ static int __devinit create_sscape(int dev, struct snd_card **rcardp)
1255} 1255}
1256 1256
1257 1257
1258static int __init snd_sscape_probe(struct platform_device *pdev) 1258static int __devinit snd_sscape_probe(struct platform_device *pdev)
1259{ 1259{
1260 int dev = pdev->id; 1260 int dev = pdev->id;
1261 struct snd_card *card; 1261 struct snd_card *card;
@@ -1469,7 +1469,7 @@ static int __init sscape_init(void)
1469 if (ret < 0) 1469 if (ret < 0)
1470 return ret; 1470 return ret;
1471#ifdef CONFIG_PNP 1471#ifdef CONFIG_PNP
1472 if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0) 1472 if (pnp_register_card_driver(&sscape_pnpc_driver) == 0)
1473 pnp_registered = 1; 1473 pnp_registered = 1;
1474#endif 1474#endif
1475 return 0; 1475 return 0;
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index c0115bf9065e..2f13cd5d4dcb 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -589,7 +589,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
589 return snd_card_register(card); 589 return snd_card_register(card);
590} 590}
591 591
592static int __init snd_wavefront_nonpnp_probe(struct platform_device *pdev) 592static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev)
593{ 593{
594 int dev = pdev->id; 594 int dev = pdev->id;
595 struct snd_card *card; 595 struct snd_card *card;
@@ -637,6 +637,7 @@ static struct platform_driver snd_wavefront_driver = {
637 637
638 638
639#ifdef CONFIG_PNP 639#ifdef CONFIG_PNP
640static unsigned int __devinitdata wavefront_pnp_devices;
640 641
641static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, 642static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
642 const struct pnp_card_device_id *pid) 643 const struct pnp_card_device_id *pid)
@@ -670,6 +671,7 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
670 671
671 pnp_set_card_drvdata(pcard, card); 672 pnp_set_card_drvdata(pcard, card);
672 dev++; 673 dev++;
674 wavefront_pnp_devices++;
673 return 0; 675 return 0;
674} 676}
675 677
@@ -729,10 +731,10 @@ static int __init alsa_card_wavefront_init(void)
729 } 731 }
730 732
731#ifdef CONFIG_PNP 733#ifdef CONFIG_PNP
732 i = pnp_register_card_driver(&wavefront_pnpc_driver); 734 err = pnp_register_card_driver(&wavefront_pnpc_driver);
733 if (i >= 0) { 735 if (!err) {
734 pnp_registered = 1; 736 pnp_registered = 1;
735 cards += i; 737 cards += wavefront_pnp_devices;
736 } 738 }
737#endif 739#endif
738 740
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index 7c59e2d4003a..c7f86f09c28d 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -360,6 +360,8 @@ static int __initdata synthio = -1;
360static int __initdata synthirq = -1; 360static int __initdata synthirq = -1;
361static int __initdata isapnp = 1; 361static int __initdata isapnp = 1;
362 362
363static unsigned int cs4232_devices;
364
363MODULE_DESCRIPTION("CS4232 based soundcard driver"); 365MODULE_DESCRIPTION("CS4232 based soundcard driver");
364MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis"); 366MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis");
365MODULE_LICENSE("GPL"); 367MODULE_LICENSE("GPL");
@@ -421,6 +423,7 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev
421 return -ENODEV; 423 return -ENODEV;
422 } 424 }
423 pnp_set_drvdata(dev,isapnpcfg); 425 pnp_set_drvdata(dev,isapnpcfg);
426 cs4232_devices++;
424 return 0; 427 return 0;
425} 428}
426 429
@@ -455,10 +458,11 @@ static int __init init_cs4232(void)
455#endif 458#endif
456 cfg.irq = -1; 459 cfg.irq = -1;
457 460
458 if (isapnp && 461 if (isapnp) {
459 (pnp_register_driver(&cs4232_driver) > 0) 462 pnp_register_driver(&cs4232_driver);
460 ) 463 if (cs4232_devices)
461 return 0; 464 return 0;
465 }
462 466
463 if(io==-1||irq==-1||dma==-1) 467 if(io==-1||irq==-1||dma==-1)
464 { 468 {
@@ -503,7 +507,8 @@ static int __init setup_cs4232(char *str)
503 int ints[7]; 507 int ints[7];
504 508
505 /* If we have isapnp cards, no need for options */ 509 /* If we have isapnp cards, no need for options */
506 if (pnp_register_driver(&cs4232_driver) > 0) 510 pnp_register_driver(&cs4232_driver);
511 if (cs4232_devices)
507 return 1; 512 return 1;
508 513
509 str = get_options(str, ARRAY_SIZE(ints), ints); 514 str = get_options(str, ARRAY_SIZE(ints), ints);
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index a8636adef2e6..c8e210326893 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -2798,7 +2798,7 @@ __init setup_beep(void)
2798 DBDMA_ALIGN(beep_dbdma_cmd_space); 2798 DBDMA_ALIGN(beep_dbdma_cmd_space);
2799 /* set up emergency dbdma cmd */ 2799 /* set up emergency dbdma cmd */
2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ; 2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ;
2801 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2801 beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2802 if (beep_buf == NULL) { 2802 if (beep_buf == NULL) {
2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); 2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n");
2804 kfree(beep_dbdma_cmd_space) ; 2804 kfree(beep_dbdma_cmd_space) ;
diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
index 959a96794dba..25ae8e4a488d 100644
--- a/sound/oss/emu10k1/midi.c
+++ b/sound/oss/emu10k1/midi.c
@@ -65,7 +65,8 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd
65 65
66 init_midi_hdr(midihdr); 66 init_midi_hdr(midihdr);
67 67
68 if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { 68 midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL);
69 if (!midihdr->data) {
69 ERROR(); 70 ERROR();
70 kfree(midihdr); 71 kfree(midihdr);
71 return -1; 72 return -1;
@@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer,
334 midihdr->bytesrecorded = 0; 335 midihdr->bytesrecorded = 0;
335 midihdr->flags = 0; 336 midihdr->flags = 0;
336 337
337 if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { 338 midihdr->data = kmalloc(count, GFP_KERNEL);
339 if (!midihdr->data) {
338 ERROR(); 340 ERROR();
339 kfree(midihdr); 341 kfree(midihdr);
340 return -EINVAL; 342 return -EINVAL;
@@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte)
545 midihdr->bytesrecorded = 0; 547 midihdr->bytesrecorded = 0;
546 midihdr->flags = 0; 548 midihdr->flags = 0;
547 549
548 if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { 550 midihdr->data = kmalloc(1, GFP_KERNEL);
551 if (!midihdr->data) {
549 ERROR(); 552 ERROR();
550 kfree(midihdr); 553 kfree(midihdr);
551 return -EINVAL; 554 return -EINVAL;
diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
index 78d3e29ce968..6861563d7525 100644
--- a/sound/oss/esssolo1.c
+++ b/sound/oss/esssolo1.c
@@ -2348,7 +2348,7 @@ static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device
2348 /* Recording requires 24-bit DMA, so attempt to set dma mask 2348 /* Recording requires 24-bit DMA, so attempt to set dma mask
2349 * to 24 bits first, then 32 bits (playback only) if that fails. 2349 * to 24 bits first, then 32 bits (playback only) if that fails.
2350 */ 2350 */
2351 if (pci_set_dma_mask(pcidev, 0x00ffffff) && 2351 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) &&
2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { 2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) {
2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n"); 2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n");
2354 return -ENODEV; 2354 return -ENODEV;
diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c
index 66044aff2586..4a5e4237a110 100644
--- a/sound/oss/maestro3.c
+++ b/sound/oss/maestro3.c
@@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m3_card *card)
2582 2582
2583 return 0; 2583 return 0;
2584} 2584}
2585static void free_dsp_suspendmem(struct m3_card *card)
2586{
2587 if(card->suspend_mem)
2588 vfree(card->suspend_mem);
2589}
2590 2585
2591#else 2586#else
2592#define alloc_dsp_suspendmem(args...) 0 2587#define alloc_dsp_suspendmem(args...) 0
2593#define free_dsp_suspendmem(args...)
2594#endif 2588#endif
2595 2589
2596/* 2590/*
@@ -2717,7 +2711,7 @@ out:
2717 if(ret) { 2711 if(ret) {
2718 if(card->iobase) 2712 if(card->iobase)
2719 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); 2713 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
2720 free_dsp_suspendmem(card); 2714 vfree(card->suspend_mem);
2721 if(card->ac97) { 2715 if(card->ac97) {
2722 unregister_sound_mixer(card->ac97->dev_mixer); 2716 unregister_sound_mixer(card->ac97->dev_mixer);
2723 kfree(card->ac97); 2717 kfree(card->ac97);
@@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev)
2760 } 2754 }
2761 2755
2762 release_region(card->iobase, 256); 2756 release_region(card->iobase, 256);
2763 free_dsp_suspendmem(card); 2757 vfree(card->suspend_mem);
2764 kfree(card); 2758 kfree(card);
2765 } 2759 }
2766 devs = NULL; 2760 devs = NULL;
diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c
index a7ad2b0a2ac0..5dbfc0f9c3c7 100644
--- a/sound/oss/msnd.c
+++ b/sound/oss/msnd.c
@@ -95,10 +95,8 @@ void msnd_fifo_init(msnd_fifo *f)
95 95
96void msnd_fifo_free(msnd_fifo *f) 96void msnd_fifo_free(msnd_fifo *f)
97{ 97{
98 if (f->data) { 98 vfree(f->data);
99 vfree(f->data); 99 f->data = NULL;
100 f->data = NULL;
101 }
102} 100}
103 101
104int msnd_fifo_alloc(msnd_fifo *f, size_t n) 102int msnd_fifo_alloc(msnd_fifo *f, size_t n)
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index 680b82e15298..4708cbdc3149 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -52,6 +52,7 @@ static int __initdata sm_games = 0; /* Logitech soundman games? */
52static struct sb_card_config *legacy = NULL; 52static struct sb_card_config *legacy = NULL;
53 53
54#ifdef CONFIG_PNP 54#ifdef CONFIG_PNP
55static int pnp_registered;
55static int __initdata pnp = 1; 56static int __initdata pnp = 1;
56/* 57/*
57static int __initdata uart401 = 0; 58static int __initdata uart401 = 0;
@@ -133,7 +134,7 @@ static void sb_unload(struct sb_card_config *scc)
133} 134}
134 135
135/* Register legacy card with OSS subsystem */ 136/* Register legacy card with OSS subsystem */
136static int sb_init_legacy(void) 137static int __init sb_init_legacy(void)
137{ 138{
138 struct sb_module_options sbmo = {0}; 139 struct sb_module_options sbmo = {0};
139 140
@@ -234,6 +235,8 @@ static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
234 } 235 }
235} 236}
236 237
238static unsigned int sb_pnp_devices;
239
237/* Probe callback function for the PnP API */ 240/* Probe callback function for the PnP API */
238static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id) 241static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id)
239{ 242{
@@ -264,6 +267,7 @@ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device
264 scc->conf.dma, scc->conf.dma2); 267 scc->conf.dma, scc->conf.dma2);
265 268
266 pnp_set_card_drvdata(card, scc); 269 pnp_set_card_drvdata(card, scc);
270 sb_pnp_devices++;
267 271
268 return sb_register_oss(scc, &sbmo); 272 return sb_register_oss(scc, &sbmo);
269} 273}
@@ -289,6 +293,14 @@ static struct pnp_card_driver sb_pnp_driver = {
289MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table); 293MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table);
290#endif /* CONFIG_PNP */ 294#endif /* CONFIG_PNP */
291 295
296static void __init_or_module sb_unregister_all(void)
297{
298#ifdef CONFIG_PNP
299 if (pnp_registered)
300 pnp_unregister_card_driver(&sb_pnp_driver);
301#endif
302}
303
292static int __init sb_init(void) 304static int __init sb_init(void)
293{ 305{
294 int lres = 0; 306 int lres = 0;
@@ -307,17 +319,18 @@ static int __init sb_init(void)
307 319
308#ifdef CONFIG_PNP 320#ifdef CONFIG_PNP
309 if(pnp) { 321 if(pnp) {
310 pres = pnp_register_card_driver(&sb_pnp_driver); 322 int err = pnp_register_card_driver(&sb_pnp_driver);
323 if (!err)
324 pnp_registered = 1;
325 pres = sb_pnp_devices;
311 } 326 }
312#endif 327#endif
313 printk(KERN_INFO "sb: Init: Done\n"); 328 printk(KERN_INFO "sb: Init: Done\n");
314 329
315 /* If either PnP or Legacy registered a card then return 330 /* If either PnP or Legacy registered a card then return
316 * success */ 331 * success */
317 if (pres <= 0 && lres <= 0) { 332 if (pres == 0 && lres <= 0) {
318#ifdef CONFIG_PNP 333 sb_unregister_all();
319 pnp_unregister_card_driver(&sb_pnp_driver);
320#endif
321 return -ENODEV; 334 return -ENODEV;
322 } 335 }
323 return 0; 336 return 0;
@@ -333,14 +346,10 @@ static void __exit sb_exit(void)
333 sb_unload(legacy); 346 sb_unload(legacy);
334 } 347 }
335 348
336#ifdef CONFIG_PNP 349 sb_unregister_all();
337 pnp_unregister_card_driver(&sb_pnp_driver);
338#endif
339 350
340 if (smw_free) { 351 vfree(smw_free);
341 vfree(smw_free); 352 smw_free = NULL;
342 smw_free = NULL;
343 }
344} 353}
345 354
346module_init(sb_init); 355module_init(sb_init);
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 347cd79c2502..6815c30e0bc1 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -1671,14 +1671,7 @@ void sequencer_init(void)
1671 1671
1672void sequencer_unload(void) 1672void sequencer_unload(void)
1673{ 1673{
1674 if(queue) 1674 vfree(queue);
1675 { 1675 vfree(iqueue);
1676 vfree(queue); 1676 queue = iqueue = NULL;
1677 queue=NULL;
1678 }
1679 if(iqueue)
1680 {
1681 vfree(iqueue);
1682 iqueue=NULL;
1683 }
1684} 1677}
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index 8a9917c919c2..3f7427cd195a 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -289,7 +289,7 @@ static int __init dac_audio_init(void)
289 289
290 in_use = 0; 290 in_use = 0;
291 291
292 data_buffer = (char *)kmalloc(BUFFER_SIZE, GFP_KERNEL); 292 data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL);
293 if (data_buffer == NULL) 293 if (data_buffer == NULL)
294 return -ENOMEM; 294 return -ENOMEM;
295 295
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 4471757b7985..42bd276cfc39 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -116,6 +116,7 @@
116#include <linux/spinlock.h> 116#include <linux/spinlock.h>
117#include <linux/smp_lock.h> 117#include <linux/smp_lock.h>
118#include <linux/gameport.h> 118#include <linux/gameport.h>
119#include <linux/dma-mapping.h>
119#include <linux/mutex.h> 120#include <linux/mutex.h>
120 121
121 122
@@ -2535,7 +2536,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id
2535 return -ENODEV; 2536 return -ENODEV;
2536 if (pcidev->irq == 0) 2537 if (pcidev->irq == 0)
2537 return -ENODEV; 2538 return -ENODEV;
2538 if (pci_set_dma_mask(pcidev, 0x00ffffff)) { 2539 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) {
2539 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n"); 2540 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n");
2540 return -ENODEV; 2541 return -ENODEV;
2541 } 2542 }
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 2aa5a7fdb6e0..c6c8333acc62 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -39,6 +39,7 @@
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/compiler.h> 40#include <linux/compiler.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <linux/dma-mapping.h>
42 43
43#include <sound/driver.h> 44#include <sound/driver.h>
44#include <sound/core.h> 45#include <sound/core.h>
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index e264136e8fb4..fc92b6896c24 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -33,6 +33,7 @@
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/dma-mapping.h>
36#include <sound/core.h> 37#include <sound/core.h>
37#include <sound/pcm.h> 38#include <sound/pcm.h>
38#include <sound/info.h> 39#include <sound/info.h>
@@ -2220,8 +2221,8 @@ static int __devinit snd_ali_create(struct snd_card *card,
2220 if ((err = pci_enable_device(pci)) < 0) 2221 if ((err = pci_enable_device(pci)) < 0)
2221 return err; 2222 return err;
2222 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2223 /* check, if we can restrict PCI DMA transfers to 31 bits */
2223 if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || 2224 if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 ||
2224 pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { 2225 pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) {
2225 snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n"); 2226 snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n");
2226 pci_disable_device(pci); 2227 pci_disable_device(pci);
2227 return -ENXIO; 2228 return -ENXIO;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 7b2ff5f4672e..100d8127a411 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -70,6 +70,7 @@
70#include <linux/slab.h> 70#include <linux/slab.h>
71#include <linux/gameport.h> 71#include <linux/gameport.h>
72#include <linux/moduleparam.h> 72#include <linux/moduleparam.h>
73#include <linux/dma-mapping.h>
73#include <sound/core.h> 74#include <sound/core.h>
74#include <sound/pcm.h> 75#include <sound/pcm.h>
75#include <sound/rawmidi.h> 76#include <sound/rawmidi.h>
@@ -688,8 +689,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
688 return err; 689 return err;
689 } 690 }
690 /* check, if we can restrict PCI DMA transfers to 24 bits */ 691 /* check, if we can restrict PCI DMA transfers to 24 bits */
691 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 692 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
692 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 693 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
693 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 694 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
694 pci_disable_device(pci); 695 pci_disable_device(pci);
695 return -ENXIO; 696 return -ENXIO;
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index e077eb3fbe2f..680077e1e057 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -104,6 +104,7 @@
104#include <linux/slab.h> 104#include <linux/slab.h>
105#include <linux/gameport.h> 105#include <linux/gameport.h>
106#include <linux/moduleparam.h> 106#include <linux/moduleparam.h>
107#include <linux/dma-mapping.h>
107#include <sound/core.h> 108#include <sound/core.h>
108#include <sound/control.h> 109#include <sound/control.h>
109#include <sound/pcm.h> 110#include <sound/pcm.h>
@@ -1669,8 +1670,8 @@ snd_azf3328_create(struct snd_card *card,
1669 chip->irq = -1; 1670 chip->irq = -1;
1670 1671
1671 /* check if we can restrict PCI DMA transfers to 24 bits */ 1672 /* check if we can restrict PCI DMA transfers to 24 bits */
1672 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1673 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1673 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1674 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1674 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1675 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1675 err = -ENXIO; 1676 err = -ENXIO;
1676 goto out_err; 1677 goto out_err;
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 2208dbd48be9..3e332f398162 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -36,6 +36,7 @@
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
39#include <linux/dma-mapping.h>
39#include <sound/core.h> 40#include <sound/core.h>
40#include <sound/initval.h> 41#include <sound/initval.h>
41#include <sound/pcm.h> 42#include <sound/pcm.h>
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 0d556b09ad04..4d62fe439177 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -55,6 +55,7 @@
55#include <linux/gameport.h> 55#include <linux/gameport.h>
56#include <linux/moduleparam.h> 56#include <linux/moduleparam.h>
57#include <linux/delay.h> 57#include <linux/delay.h>
58#include <linux/dma-mapping.h>
58#include <sound/core.h> 59#include <sound/core.h>
59#include <sound/control.h> 60#include <sound/control.h>
60#include <sound/pcm.h> 61#include <sound/pcm.h>
@@ -1517,8 +1518,8 @@ static int __devinit snd_es1938_create(struct snd_card *card,
1517 if ((err = pci_enable_device(pci)) < 0) 1518 if ((err = pci_enable_device(pci)) < 0)
1518 return err; 1519 return err;
1519 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1520 /* check, if we can restrict PCI DMA transfers to 24 bits */
1520 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1521 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1521 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1522 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1522 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1523 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1523 pci_disable_device(pci); 1524 pci_disable_device(pci);
1524 return -ENXIO; 1525 return -ENXIO;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index dd465a186e11..e3ad17f53c29 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -104,6 +104,7 @@
104#include <linux/slab.h> 104#include <linux/slab.h>
105#include <linux/gameport.h> 105#include <linux/gameport.h>
106#include <linux/moduleparam.h> 106#include <linux/moduleparam.h>
107#include <linux/dma-mapping.h>
107#include <linux/mutex.h> 108#include <linux/mutex.h>
108 109
109#include <sound/core.h> 110#include <sound/core.h>
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 672e198317e1..b88eeba2f5d1 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -56,7 +56,9 @@
56#include <linux/dma-mapping.h> 56#include <linux/dma-mapping.h>
57#include <linux/slab.h> 57#include <linux/slab.h>
58#include <linux/moduleparam.h> 58#include <linux/moduleparam.h>
59#include <linux/dma-mapping.h>
59#include <linux/mutex.h> 60#include <linux/mutex.h>
61
60#include <sound/core.h> 62#include <sound/core.h>
61#include <sound/cs8427.h> 63#include <sound/cs8427.h>
62#include <sound/info.h> 64#include <sound/info.h>
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 8bc084956c28..44393e190929 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -41,6 +41,7 @@
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/vmalloc.h> 42#include <linux/vmalloc.h>
43#include <linux/moduleparam.h> 43#include <linux/moduleparam.h>
44#include <linux/dma-mapping.h>
44#include <sound/core.h> 45#include <sound/core.h>
45#include <sound/info.h> 46#include <sound/info.h>
46#include <sound/control.h> 47#include <sound/control.h>
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 43ee3b2b948f..b5a095052d4c 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -28,6 +28,8 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/dma-mapping.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/initval.h> 34#include <sound/initval.h>
33#include <sound/info.h> 35#include <sound/info.h>
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index f679779d96e3..35875c8aa299 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/dma-mapping.h>
33 34
34#include <sound/core.h> 35#include <sound/core.h>
35#include <sound/initval.h> 36#include <sound/initval.h>
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 0cbef5fe6c63..ab78544bf042 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -313,7 +313,7 @@ static int snd_rme32_capture_copy(struct snd_pcm_substream *substream, int chann
313} 313}
314 314
315/* 315/*
316 * SPDIF I/O capabilites (half-duplex mode) 316 * SPDIF I/O capabilities (half-duplex mode)
317 */ 317 */
318static struct snd_pcm_hardware snd_rme32_spdif_info = { 318static struct snd_pcm_hardware snd_rme32_spdif_info = {
319 .info = (SNDRV_PCM_INFO_MMAP_IOMEM | 319 .info = (SNDRV_PCM_INFO_MMAP_IOMEM |
@@ -339,7 +339,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_info = {
339}; 339};
340 340
341/* 341/*
342 * ADAT I/O capabilites (half-duplex mode) 342 * ADAT I/O capabilities (half-duplex mode)
343 */ 343 */
344static struct snd_pcm_hardware snd_rme32_adat_info = 344static struct snd_pcm_hardware snd_rme32_adat_info =
345{ 345{
@@ -364,7 +364,7 @@ static struct snd_pcm_hardware snd_rme32_adat_info =
364}; 364};
365 365
366/* 366/*
367 * SPDIF I/O capabilites (full-duplex mode) 367 * SPDIF I/O capabilities (full-duplex mode)
368 */ 368 */
369static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { 369static struct snd_pcm_hardware snd_rme32_spdif_fd_info = {
370 .info = (SNDRV_PCM_INFO_MMAP | 370 .info = (SNDRV_PCM_INFO_MMAP |
@@ -390,7 +390,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = {
390}; 390};
391 391
392/* 392/*
393 * ADAT I/O capabilites (full-duplex mode) 393 * ADAT I/O capabilities (full-duplex mode)
394 */ 394 */
395static struct snd_pcm_hardware snd_rme32_adat_fd_info = 395static struct snd_pcm_hardware snd_rme32_adat_fd_info =
396{ 396{
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 0e694b011dcc..6c2a9f4a7659 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -359,7 +359,7 @@ snd_rme96_capture_copy(struct snd_pcm_substream *substream,
359} 359}
360 360
361/* 361/*
362 * Digital output capabilites (S/PDIF) 362 * Digital output capabilities (S/PDIF)
363 */ 363 */
364static struct snd_pcm_hardware snd_rme96_playback_spdif_info = 364static struct snd_pcm_hardware snd_rme96_playback_spdif_info =
365{ 365{
@@ -388,7 +388,7 @@ static struct snd_pcm_hardware snd_rme96_playback_spdif_info =
388}; 388};
389 389
390/* 390/*
391 * Digital input capabilites (S/PDIF) 391 * Digital input capabilities (S/PDIF)
392 */ 392 */
393static struct snd_pcm_hardware snd_rme96_capture_spdif_info = 393static struct snd_pcm_hardware snd_rme96_capture_spdif_info =
394{ 394{
@@ -417,7 +417,7 @@ static struct snd_pcm_hardware snd_rme96_capture_spdif_info =
417}; 417};
418 418
419/* 419/*
420 * Digital output capabilites (ADAT) 420 * Digital output capabilities (ADAT)
421 */ 421 */
422static struct snd_pcm_hardware snd_rme96_playback_adat_info = 422static struct snd_pcm_hardware snd_rme96_playback_adat_info =
423{ 423{
@@ -442,7 +442,7 @@ static struct snd_pcm_hardware snd_rme96_playback_adat_info =
442}; 442};
443 443
444/* 444/*
445 * Digital input capabilites (ADAT) 445 * Digital input capabilities (ADAT)
446 */ 446 */
447static struct snd_pcm_hardware snd_rme96_capture_adat_info = 447static struct snd_pcm_hardware snd_rme96_capture_adat_info =
448{ 448{
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 980b9cd689dd..b5538efd146b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2256,7 +2256,7 @@ static int snd_hdspm_create_controls(struct snd_card *card, struct hdspm * hdspm
2256 } 2256 }
2257 2257
2258 /* Channel playback mixer as default control 2258 /* Channel playback mixer as default control
2259 Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats to big for any alsamixer 2259 Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats too big for any alsamixer
2260 they are accesible via special IOCTL on hwdep 2260 they are accesible via special IOCTL on hwdep
2261 and the mixer 2dimensional mixer control */ 2261 and the mixer 2dimensional mixer control */
2262 2262
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 7bbea3738b8a..2d66a09fe5ee 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -30,6 +30,7 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/gameport.h> 31#include <linux/gameport.h>
32#include <linux/moduleparam.h> 32#include <linux/moduleparam.h>
33#include <linux/dma-mapping.h>
33 34
34#include <sound/core.h> 35#include <sound/core.h>
35#include <sound/pcm.h> 36#include <sound/pcm.h>
@@ -1227,8 +1228,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card,
1227 if ((err = pci_enable_device(pci)) < 0) 1228 if ((err = pci_enable_device(pci)) < 0)
1228 return err; 1229 return err;
1229 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1230 /* check, if we can restrict PCI DMA transfers to 24 bits */
1230 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1231 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1231 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1232 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1232 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1233 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1233 pci_disable_device(pci); 1234 pci_disable_device(pci);
1234 return -ENXIO; 1235 return -ENXIO;
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 83b7d8aba9e6..52178b8ad49d 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -35,6 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include <linux/gameport.h> 37#include <linux/gameport.h>
38#include <linux/dma-mapping.h>
38 39
39#include <sound/core.h> 40#include <sound/core.h>
40#include <sound/info.h> 41#include <sound/info.h>
@@ -3554,8 +3555,8 @@ int __devinit snd_trident_create(struct snd_card *card,
3554 if ((err = pci_enable_device(pci)) < 0) 3555 if ((err = pci_enable_device(pci)) < 0)
3555 return err; 3556 return err;
3556 /* check, if we can restrict PCI DMA transfers to 30 bits */ 3557 /* check, if we can restrict PCI DMA transfers to 30 bits */
3557 if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || 3558 if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 ||
3558 pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { 3559 pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) {
3559 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); 3560 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n");
3560 pci_disable_device(pci); 3561 pci_disable_device(pci);
3561 return -ENXIO; 3562 return -ENXIO;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 394b53e20cb8..6f849720aef3 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -53,7 +53,7 @@
53struct sound_unit 53struct sound_unit
54{ 54{
55 int unit_minor; 55 int unit_minor;
56 struct file_operations *unit_fops; 56 const struct file_operations *unit_fops;
57 struct sound_unit *next; 57 struct sound_unit *next;
58 char name[32]; 58 char name[32];
59}; 59};
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class);
73 * join into it. Called with the lock asserted 73 * join into it. Called with the lock asserted
74 */ 74 */
75 75
76static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, struct file_operations *fops, int index, int low, int top) 76static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, const struct file_operations *fops, int index, int low, int top)
77{ 77{
78 int n=low; 78 int n=low;
79 79
@@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock);
153 * list. Acquires locks as needed 153 * list. Acquires locks as needed
154 */ 154 */
155 155
156static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) 156static int sound_insert_unit(struct sound_unit **list, const struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev)
157{ 157{
158 struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); 158 struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL);
159 int r; 159 int r;
@@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP];
237 * a negative error code is returned. 237 * a negative error code is returned.
238 */ 238 */
239 239
240int register_sound_special_device(struct file_operations *fops, int unit, 240int register_sound_special_device(const struct file_operations *fops, int unit,
241 struct device *dev) 241 struct device *dev)
242{ 242{
243 const int chain = unit % SOUND_STEP; 243 const int chain = unit % SOUND_STEP;
@@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit,
301 301
302EXPORT_SYMBOL(register_sound_special_device); 302EXPORT_SYMBOL(register_sound_special_device);
303 303
304int register_sound_special(struct file_operations *fops, int unit) 304int register_sound_special(const struct file_operations *fops, int unit)
305{ 305{
306 return register_sound_special_device(fops, unit, NULL); 306 return register_sound_special_device(fops, unit, NULL);
307} 307}
@@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special);
318 * number is returned, on failure a negative error code is returned. 318 * number is returned, on failure a negative error code is returned.
319 */ 319 */
320 320
321int register_sound_mixer(struct file_operations *fops, int dev) 321int register_sound_mixer(const struct file_operations *fops, int dev)
322{ 322{
323 return sound_insert_unit(&chains[0], fops, dev, 0, 128, 323 return sound_insert_unit(&chains[0], fops, dev, 0, 128,
324 "mixer", S_IRUSR | S_IWUSR, NULL); 324 "mixer", S_IRUSR | S_IWUSR, NULL);
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer);
336 * number is returned, on failure a negative error code is returned. 336 * number is returned, on failure a negative error code is returned.
337 */ 337 */
338 338
339int register_sound_midi(struct file_operations *fops, int dev) 339int register_sound_midi(const struct file_operations *fops, int dev)
340{ 340{
341 return sound_insert_unit(&chains[2], fops, dev, 2, 130, 341 return sound_insert_unit(&chains[2], fops, dev, 2, 130,
342 "midi", S_IRUSR | S_IWUSR, NULL); 342 "midi", S_IRUSR | S_IWUSR, NULL);
@@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi);
362 * and will always allocate them as a matching pair - eg dsp3/audio3 362 * and will always allocate them as a matching pair - eg dsp3/audio3
363 */ 363 */
364 364
365int register_sound_dsp(struct file_operations *fops, int dev) 365int register_sound_dsp(const struct file_operations *fops, int dev)
366{ 366{
367 return sound_insert_unit(&chains[3], fops, dev, 3, 131, 367 return sound_insert_unit(&chains[3], fops, dev, 3, 131,
368 "dsp", S_IWUSR | S_IRUSR, NULL); 368 "dsp", S_IWUSR | S_IRUSR, NULL);
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp);
381 */ 381 */
382 382
383 383
384int register_sound_synth(struct file_operations *fops, int dev) 384int register_sound_synth(const struct file_operations *fops, int dev)
385{ 385{
386 return sound_insert_unit(&chains[9], fops, dev, 9, 137, 386 return sound_insert_unit(&chains[9], fops, dev, 9, 137,
387 "synth", S_IRUSR | S_IWUSR, NULL); 387 "synth", S_IRUSR | S_IWUSR, NULL);
@@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file)
501 int chain; 501 int chain;
502 int unit = iminor(inode); 502 int unit = iminor(inode);
503 struct sound_unit *s; 503 struct sound_unit *s;
504 struct file_operations *new_fops = NULL; 504 const struct file_operations *new_fops = NULL;
505 505
506 chain=unit&0x0F; 506 chain=unit&0x0F;
507 if(chain==4 || chain==5) /* dsp/audio/dsp16 */ 507 if(chain==4 || chain==5) /* dsp/audio/dsp16 */
@@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file)
540 * switching ->f_op in the first place. 540 * switching ->f_op in the first place.
541 */ 541 */
542 int err = 0; 542 int err = 0;
543 struct file_operations *old_fops = file->f_op; 543 const struct file_operations *old_fops = file->f_op;
544 file->f_op = new_fops; 544 file->f_op = new_fops;
545 spin_unlock(&sound_loader_lock); 545 spin_unlock(&sound_loader_lock);
546 if(file->f_op->open) 546 if(file->f_op->open)
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 315855082fe1..fe67a92e2a1a 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -404,7 +404,7 @@ static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs)
404 struct usX2Ydev * usX2Y = subs->usX2Y; 404 struct usX2Ydev * usX2Y = subs->usX2Y;
405 usX2Y->prepare_subs = subs; 405 usX2Y->prepare_subs = subs;
406 subs->urb[0]->start_frame = -1; 406 subs->urb[0]->start_frame = -1;
407 smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() 407 smp_wmb(); // Make sure above modifications are seen by i_usX2Y_subs_startup()
408 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); 408 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup);
409} 409}
410 410