diff options
Diffstat (limited to 'sound')
59 files changed, 273 insertions, 228 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index ad68761..5bb8a8b 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card) struct snd_monitor_file *mfile; struct file *file; struct snd_shutdown_f_ops *s_f_ops; - struct file_operations *f_ops, *old_f_ops; + struct file_operations *f_ops; + const struct file_operations *old_f_ops; int err; spin_lock(&card->files_lock); diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 6b7a367..87b47c9 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, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) + newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + if (!newbuf) return -ENOMEM; kfree(runtime->buffer); runtime->buffer = newbuf; @@ -657,7 +658,8 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) + newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + if (!newbuf) return -ENOMEM; kfree(runtime->buffer); runtime->buffer = newbuf; diff --git a/sound/core/sound.c b/sound/core/sound.c index 4d28e52..108e430 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) { unsigned int minor = iminor(inode); struct snd_minor *mptr = NULL; - struct file_operations *old_fops; + const struct file_operations *old_fops; int err = 0; if (minor >= ARRAY_SIZE(snd_minors)) @@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) * Retrurns zero if successful, or a negative error code on failure. */ int snd_register_device(int type, struct snd_card *card, int dev, - struct file_operations *f_ops, void *private_data, + const struct file_operations *f_ops, void *private_data, const char *name) { int minor; diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 4023d3b..9055c6d 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) } int snd_register_oss_device(int type, struct snd_card *card, int dev, - struct file_operations *f_ops, void *private_data, + const struct file_operations *f_ops, void *private_data, const char *name) { int minor = snd_oss_kernel_minor(type, card, dev); diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 9d10d79..9ea3059 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -59,7 +59,8 @@ module_param_array(irq, int, NULL, 0444); MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); static struct platform_device *platform_devices[SNDRV_CARDS]; -static int pnp_registered = 0; +static int pnp_registered; +static unsigned int snd_mpu401_devices; static int snd_mpu401_create(int dev, struct snd_card **rcard) { @@ -197,6 +198,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, } snd_card_set_dev(card, &pnp_dev->dev); pnp_set_drvdata(pnp_dev, card); + snd_mpu401_devices++; ++dev; return 0; } @@ -234,12 +236,11 @@ static void __init_or_module snd_mpu401_unregister_all(void) static int __init alsa_card_mpu401_init(void) { - int i, err, devices; + int i, err; if ((err = platform_driver_register(&snd_mpu401_driver)) < 0) return err; - devices = 0; for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; if (! enable[i]) @@ -255,14 +256,13 @@ static int __init alsa_card_mpu401_init(void) goto errout; } platform_devices[i] = device; - devices++; + snd_mpu401_devices++; } - if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) { + err = pnp_register_driver(&snd_mpu401_pnp_driver); + if (!err) pnp_registered = 1; - devices += err; - } - if (!devices) { + if (!snd_mpu401_devices) { #ifdef MODULE printk(KERN_ERR "MPU-401 device not found or device busy\n"); #endif diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 7051f77..31f299a 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 return 0; } +static unsigned int __devinitdata ad1816a_devices; + static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -275,6 +277,7 @@ static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + ad1816a_devices++; return 0; } return -ENODEV; @@ -297,10 +300,13 @@ static struct pnp_card_driver ad1816a_pnpc_driver = { static int __init alsa_card_ad1816a_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&ad1816a_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&ad1816a_pnpc_driver); - if (cards <= 0) { + if (!ad1816a_devices) { pnp_unregister_card_driver(&ad1816a_pnpc_driver); #ifdef MODULE printk(KERN_ERR "no AD1816A based soundcards found.\n"); diff --git a/sound/isa/als100.c b/sound/isa/als100.c index 9b77c17..a52bd8a 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, return 0; } -static int __init snd_card_als100_probe(int dev, +static int __devinit snd_card_als100_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -281,6 +281,8 @@ static int __init snd_card_als100_probe(int dev, return 0; } +static unsigned int __devinitdata als100_devices; + static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -294,6 +296,7 @@ static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + als100_devices++; return 0; } return -ENODEV; @@ -345,10 +348,13 @@ static struct pnp_card_driver als100_pnpc_driver = { static int __init alsa_card_als100_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&als100_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&als100_pnpc_driver); - if (cards <= 0) { + if (!als100_devices) { pnp_unregister_card_driver(&als100_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no ALS100 based soundcards found\n"); diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index a530691..15e5928 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -310,6 +310,8 @@ static int __devinit snd_card_azt2320_probe(int dev, return 0; } +static unsigned int __devinitdata azt2320_devices; + static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -323,6 +325,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + azt2320_devices++; return 0; } return -ENODEV; @@ -372,10 +375,13 @@ static struct pnp_card_driver azt2320_pnpc_driver = { static int __init alsa_card_azt2320_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&azt2320_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&azt2320_pnpc_driver); - if (cards <= 0) { + if (!azt2320_devices) { pnp_unregister_card_driver(&azt2320_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index fd9bb25..fa63048a 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -175,7 +175,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids); #endif -static struct ad1848_mix_elem snd_cmi8330_controls[] __initdata = { +static struct ad1848_mix_elem snd_cmi8330_controls[] __devinitdata = { AD1848_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1), AD1848_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 }; #ifdef ENABLE_SB_MIXER -static struct sbmix_elem cmi8330_sb_mixers[] __initdata = { +static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = { SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), SB_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 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), }; -static unsigned char cmi8330_sb_init_values[][2] __initdata = { +static unsigned char cmi8330_sb_init_values[][2] __devinitdata = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -545,7 +545,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_cmi8330_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev) { struct snd_card *card; int err; @@ -607,6 +607,8 @@ static struct platform_driver snd_cmi8330_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata cmi8330_pnp_devices; + static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -636,6 +638,7 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + cmi8330_pnp_devices++; return 0; } @@ -706,9 +709,9 @@ static int __init alsa_card_cmi8330_init(void) #ifdef CONFIG_PNP err = pnp_register_card_driver(&cmi8330_pnpc_driver); - if (err >= 0) { + if (!err) { pnp_registered = 1; - cards += err; + cards += cmi8330_pnp_devices; } #endif diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 4060918..382bb17 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -133,6 +133,7 @@ static int pnpc_registered; static int pnp_registered; #endif #endif /* CONFIG_PNP */ +static unsigned int snd_cs423x_devices; struct snd_card_cs4236 { struct snd_cs4231 *chip; @@ -564,7 +565,7 @@ static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev) snd_card_free(card); return err; } - + platform_set_drvdata(pdev, card); return 0; } @@ -650,6 +651,7 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_cs423x_devices++; return 0; } @@ -713,6 +715,7 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_cs423x_devices++; return 0; } @@ -721,7 +724,7 @@ static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link * pcard) snd_card_free(pnp_get_card_drvdata(pcard)); pnp_set_card_drvdata(pcard, NULL); } - + #ifdef CONFIG_PM static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state) { @@ -766,7 +769,7 @@ static void __init_or_module snd_cs423x_unregister_all(void) static int __init alsa_card_cs423x_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) return err; @@ -782,24 +785,20 @@ static int __init alsa_card_cs423x_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_cs423x_devices++; } #ifdef CONFIG_PNP #ifdef CS4232 - i = pnp_register_driver(&cs4232_pnp_driver); - if (i >= 0) { + err = pnp_register_driver(&cs4232_pnp_driver); + if (!err) pnp_registered = 1; - cards += i; - } #endif - i = pnp_register_card_driver(&cs423x_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&cs423x_pnpc_driver); + if (!err) pnpc_registered = 1; - cards += i; - } #endif /* CONFIG_PNP */ - if (!cards) { + if (!snd_cs423x_devices) { #ifdef MODULE printk(KERN_ERR IDENT " soundcard not found or device busy\n"); #endif diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c index 50e7bc5..0acb4e5 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, return 0; } +static unsigned int __devinitdata dt019x_devices; + static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *pid) { @@ -285,6 +287,7 @@ static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, if (res < 0) return res; dev++; + dt019x_devices++; return 0; } return -ENODEV; @@ -336,10 +339,13 @@ static struct pnp_card_driver dt019x_pnpc_driver = { static int __init alsa_card_dt019x_init(void) { - int cards = 0; + int err; + + err = pnp_register_card_driver(&dt019x_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&dt019x_pnpc_driver); - if (cards <= 0) { + if (!dt019x_devices) { pnp_unregister_card_driver(&dt019x_pnpc_driver); #ifdef MODULE 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 721955d..9fbc185 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) return snd_card_register(card); } -static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -2221,7 +2221,7 @@ static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devp return 0; } -static int __init snd_es18xx_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -2297,6 +2297,8 @@ static struct platform_driver snd_es18xx_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata es18xx_pnp_devices; + static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -2327,6 +2329,7 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + es18xx_pnp_devices++; return 0; } @@ -2397,10 +2400,10 @@ static int __init alsa_card_es18xx_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&es18xx_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&es18xx_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += es18xx_pnp_devices; } #endif diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 2cacd0f..de71b7a9 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) return 0; } -static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -809,7 +809,7 @@ static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *d return 0; } -static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -867,6 +867,7 @@ static struct platform_driver snd_interwave_driver = { }; #ifdef CONFIG_PNP +static unsigned int __devinitdata interwave_pnp_devices; static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -897,6 +898,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + interwave_pnp_devices++; return 0; } @@ -954,10 +956,10 @@ static int __init alsa_card_interwave_init(void) } /* ISA PnP cards */ - i = pnp_register_card_driver(&interwave_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&interwave_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += interwave_pnp_devices;; } if (!cards) { diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 56fcd8a..c906e20 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -95,6 +95,7 @@ static struct platform_device *platform_devices[SNDRV_CARDS]; static int pnp_registered; static int pnpc_registered; #endif +static unsigned int snd_opl3sa2_devices; /* control ports */ #define OPL3SA2_PM_CTRL 0x01 @@ -760,6 +761,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -826,6 +828,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -944,7 +947,7 @@ static void __init_or_module snd_opl3sa2_unregister_all(void) static int __init alsa_card_opl3sa2_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) return err; @@ -964,23 +967,19 @@ static int __init alsa_card_opl3sa2_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_opl3sa2_devices++; } #ifdef CONFIG_PNP err = pnp_register_driver(&opl3sa2_pnp_driver); - if (err >= 0) { + if (!err) pnp_registered = 1; - cards += err; - } err = pnp_register_card_driver(&opl3sa2_pnpc_driver); - if (err >= 0) { + if (!err) pnpc_registered = 1; - cards += err; - } #endif - if (!cards) { + if (!snd_opl3sa2_devices) { #ifdef MODULE snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); #endif diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c index 9da80bf..d4d65b8 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, return 0; } -static int __init snd_card_es968_probe(int dev, +static int __devinit snd_card_es968_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -182,6 +182,8 @@ static int __init snd_card_es968_probe(int dev, return 0; } +static unsigned int __devinitdata es968_devices; + static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -195,6 +197,7 @@ static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + es968_devices++; return 0; } return -ENODEV; @@ -246,8 +249,11 @@ static struct pnp_card_driver es968_pnpc_driver = { static int __init alsa_card_es968_init(void) { - int cards = pnp_register_card_driver(&es968_pnpc_driver); - if (cards <= 0) { + int err = pnp_register_card_driver(&es968_pnpc_driver); + if (err) + return err; + + if (!es968_devices) { pnp_unregister_card_driver(&es968_pnpc_driver); #ifdef MODULE 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 5737ab7..21ea659 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) return card; } -static int __init snd_sb16_probe(struct snd_card *card, int dev) +static int __devinit snd_sb16_probe(struct snd_card *card, int dev) { int xirq, xdma8, xdma16; struct snd_sb *chip; @@ -518,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) } #endif -static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card_sb16 *acard; struct snd_card *card; @@ -548,7 +548,7 @@ static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr } -static int __init snd_sb16_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -629,6 +629,7 @@ static struct platform_driver snd_sb16_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata sb16_pnp_devices; static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -651,6 +652,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + sb16_pnp_devices++; return 0; } @@ -727,10 +729,10 @@ static int __init alsa_card_sb16_init(void) } #ifdef CONFIG_PNP /* PnP cards at last */ - i = pnp_register_card_driver(&sb16_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&sb16_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += sb16_pnp_devices; } #endif diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 29bba8c..48e5552 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) } -static int __init snd_sscape_probe(struct platform_device *pdev) +static int __devinit snd_sscape_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -1469,7 +1469,7 @@ static int __init sscape_init(void) if (ret < 0) return ret; #ifdef CONFIG_PNP - if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0) + if (pnp_register_card_driver(&sscape_pnpc_driver) == 0) pnp_registered = 1; #endif return 0; diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index c0115bf..2f13cd5 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) return snd_card_register(card); } -static int __init snd_wavefront_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -637,6 +637,7 @@ static struct platform_driver snd_wavefront_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata wavefront_pnp_devices; static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -670,6 +671,7 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + wavefront_pnp_devices++; return 0; } @@ -729,10 +731,10 @@ static int __init alsa_card_wavefront_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&wavefront_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&wavefront_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += wavefront_pnp_devices; } #endif diff --git a/sound/oss/.gitignore b/sound/oss/.gitignore new file mode 100644 index 0000000..7efb12b --- /dev/null +++ b/sound/oss/.gitignore @@ -0,0 +1,4 @@ +#Ignore generated files +maui_boot.h +pss_boot.h +trix_boot.h diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c index fe54de2..eacb0ae 100644 --- a/sound/oss/au1000.c +++ b/sound/oss/au1000.c @@ -100,7 +100,7 @@ /* Boot options */ static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it -MODULE_PARM(vra, "i"); +module_param(vra, bool, 0); MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 6a4956b..c1168fa 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c @@ -79,7 +79,7 @@ * 0 = no VRA, 1 = use VRA if codec supports it */ static int vra = 1; -MODULE_PARM(vra, "i"); +module_param(vra, bool, 0); MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); static struct au1550_state { diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index b3ea719..d1a0eb2 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c @@ -2944,7 +2944,7 @@ alloc_new_info(void) { awe_voice_list *newlist; - newlist = (awe_voice_list *)kmalloc(sizeof(*newlist), GFP_KERNEL); + newlist = kmalloc(sizeof(*newlist), GFP_KERNEL); if (newlist == NULL) { printk(KERN_ERR "AWE32: can't alloc info table\n"); return NULL; @@ -3547,8 +3547,10 @@ awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag) smp->checksum_flag = 0; smp->checksum = 0; - if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) + if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) { + kfree(vrec); return rc; + } sf->mem_ptr += rc; add_sf_sample(sf, smprec); diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c index 1fbd513..de60a05 100644 --- a/sound/oss/cmpci.c +++ b/sound/oss/cmpci.c @@ -1713,7 +1713,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ if (get_user(val, p)) return -EFAULT; - i = generic_hweight32(val); + i = hweight32(val); for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (!(val & (1 << i))) continue; diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c index 7c59e2d..c7f86f0 100644 --- a/sound/oss/cs4232.c +++ b/sound/oss/cs4232.c @@ -360,6 +360,8 @@ static int __initdata synthio = -1; static int __initdata synthirq = -1; static int __initdata isapnp = 1; +static unsigned int cs4232_devices; + MODULE_DESCRIPTION("CS4232 based soundcard driver"); MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis"); MODULE_LICENSE("GPL"); @@ -421,6 +423,7 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev return -ENODEV; } pnp_set_drvdata(dev,isapnpcfg); + cs4232_devices++; return 0; } @@ -455,10 +458,11 @@ static int __init init_cs4232(void) #endif cfg.irq = -1; - if (isapnp && - (pnp_register_driver(&cs4232_driver) > 0) - ) - return 0; + if (isapnp) { + pnp_register_driver(&cs4232_driver); + if (cs4232_devices) + return 0; + } if(io==-1||irq==-1||dma==-1) { @@ -503,7 +507,8 @@ static int __init setup_cs4232(char *str) int ints[7]; /* If we have isapnp cards, no need for options */ - if (pnp_register_driver(&cs4232_driver) > 0) + pnp_register_driver(&cs4232_driver); + if (cs4232_devices) return 1; 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 6ba8d6f..c8e2103 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c @@ -2798,7 +2798,7 @@ __init setup_beep(void) DBDMA_ALIGN(beep_dbdma_cmd_space); /* set up emergency dbdma cmd */ emergency_dbdma_cmd = beep_dbdma_cmd+1 ; - beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); + beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); if (beep_buf == NULL) { printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); kfree(beep_dbdma_cmd_space) ; @@ -2814,7 +2814,7 @@ int __init dmasound_awacs_init(void) struct device_node *io = NULL, *info = NULL; int vol, res; - if (_machine != _MACH_Pmac) + if (!machine_is(powermac)) return -ENODEV; awacs_subframe = 0; diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index c9302a1..87bd310 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -195,18 +195,18 @@ */ int dmasound_catchRadius = 0; -MODULE_PARM(dmasound_catchRadius, "i"); +module_param(dmasound_catchRadius, int, 0); static unsigned int numWriteBufs = DEFAULT_N_BUFFERS; -MODULE_PARM(numWriteBufs, "i"); +module_param(numWriteBufs, int, 0); static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ -MODULE_PARM(writeBufSize, "i"); +module_param(writeBufSize, int, 0); #ifdef HAS_RECORD static unsigned int numReadBufs = DEFAULT_N_BUFFERS; -MODULE_PARM(numReadBufs, "i"); +module_param(numReadBufs, int, 0); static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */ -MODULE_PARM(readBufSize, "i"); +module_param(readBufSize, int, 0); #endif MODULE_LICENSE("GPL"); diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index 959a967..25ae8e4 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 init_midi_hdr(midihdr); - if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -1; @@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(count, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; @@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte) midihdr->bytesrecorded = 0; midihdr->flags = 0; - if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { + midihdr->data = kmalloc(1, GFP_KERNEL); + if (!midihdr->data) { ERROR(); kfree(midihdr); return -EINVAL; diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c index 78d3e29..6861563 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 /* Recording requires 24-bit DMA, so attempt to set dma mask * to 24 bits first, then 32 bits (playback only) if that fails. */ - if (pci_set_dma_mask(pcidev, 0x00ffffff) && + if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) && pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n"); return -ENODEV; diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c index ffcb910..00ac1c9 100644 --- a/sound/oss/ite8172.c +++ b/sound/oss/ite8172.c @@ -1968,9 +1968,9 @@ static int i2s_fmt[NR_DEVICE]; static unsigned int devindex; -MODULE_PARM(spdif, "1-" __MODULE_STRING(NR_DEVICE) "i"); +module_param_array(spdif, int, NULL, 0); MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled"); -MODULE_PARM(i2s_fmt, "1-" __MODULE_STRING(NR_DEVICE) "i"); +module_param_array(i2s_fmt, int, NULL, 0); MODULE_PARM_DESC(i2s_fmt, "the format of I2S"); MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com"); diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c index 66044af..4a5e423 100644 --- a/sound/oss/maestro3.c +++ b/sound/oss/maestro3.c @@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m3_card *card) return 0; } -static void free_dsp_suspendmem(struct m3_card *card) -{ - if(card->suspend_mem) - vfree(card->suspend_mem); -} #else #define alloc_dsp_suspendmem(args...) 0 -#define free_dsp_suspendmem(args...) #endif /* @@ -2717,7 +2711,7 @@ out: if(ret) { if(card->iobase) release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); if(card->ac97) { unregister_sound_mixer(card->ac97->dev_mixer); kfree(card->ac97); @@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev) } release_region(card->iobase, 256); - free_dsp_suspendmem(card); + vfree(card->suspend_mem); kfree(card); } devs = NULL; diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c index a7ad2b0..5dbfc0f 100644 --- a/sound/oss/msnd.c +++ b/sound/oss/msnd.c @@ -95,10 +95,8 @@ void msnd_fifo_init(msnd_fifo *f) void msnd_fifo_free(msnd_fifo *f) { - if (f->data) { - vfree(f->data); - f->data = NULL; - } + vfree(f->data); + f->data = NULL; } int msnd_fifo_alloc(msnd_fifo *f, size_t n) diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c index 680b82e..4708cbd 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? */ static struct sb_card_config *legacy = NULL; #ifdef CONFIG_PNP +static int pnp_registered; static int __initdata pnp = 1; /* static int __initdata uart401 = 0; @@ -133,7 +134,7 @@ static void sb_unload(struct sb_card_config *scc) } /* Register legacy card with OSS subsystem */ -static int sb_init_legacy(void) +static int __init sb_init_legacy(void) { struct sb_module_options sbmo = {0}; @@ -234,6 +235,8 @@ static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc) } } +static unsigned int sb_pnp_devices; + /* Probe callback function for the PnP API */ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *card_id) { @@ -264,6 +267,7 @@ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device scc->conf.dma, scc->conf.dma2); pnp_set_card_drvdata(card, scc); + sb_pnp_devices++; return sb_register_oss(scc, &sbmo); } @@ -289,6 +293,14 @@ static struct pnp_card_driver sb_pnp_driver = { MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table); #endif /* CONFIG_PNP */ +static void __init_or_module sb_unregister_all(void) +{ +#ifdef CONFIG_PNP + if (pnp_registered) + pnp_unregister_card_driver(&sb_pnp_driver); +#endif +} + static int __init sb_init(void) { int lres = 0; @@ -307,17 +319,18 @@ static int __init sb_init(void) #ifdef CONFIG_PNP if(pnp) { - pres = pnp_register_card_driver(&sb_pnp_driver); + int err = pnp_register_card_driver(&sb_pnp_driver); + if (!err) + pnp_registered = 1; + pres = sb_pnp_devices; } #endif printk(KERN_INFO "sb: Init: Done\n"); /* If either PnP or Legacy registered a card then return * success */ - if (pres <= 0 && lres <= 0) { -#ifdef CONFIG_PNP - pnp_unregister_card_driver(&sb_pnp_driver); -#endif + if (pres == 0 && lres <= 0) { + sb_unregister_all(); return -ENODEV; } return 0; @@ -333,14 +346,10 @@ static void __exit sb_exit(void) sb_unload(legacy); } -#ifdef CONFIG_PNP - pnp_unregister_card_driver(&sb_pnp_driver); -#endif + sb_unregister_all(); - if (smw_free) { - vfree(smw_free); - smw_free = NULL; - } + vfree(smw_free); + smw_free = NULL; } module_init(sb_init); diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index f56898c..ccb21d4 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c @@ -273,14 +273,14 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right) int regoffs; unsigned char val; + if ((dev < 0) || (dev >= devc->iomap_sz)) + return -EINVAL; + regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; if (regoffs == 0) return -EINVAL; - if ((dev < 0) || (dev >= devc->iomap_sz)) - return -EINVAL; - val = sb_getmixer(devc, regoffs); change_bits(devc, &val, dev, LEFT_CHN, left); diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 6986142..6815c30 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c @@ -709,11 +709,11 @@ static void seq_local_event(unsigned char *event_rec) static void seq_sysex_message(unsigned char *event_rec) { - int dev = event_rec[1]; + unsigned int dev = event_rec[1]; int i, l = 0; unsigned char *buf = &event_rec[2]; - if ((int) dev > max_synthdev) + if (dev > max_synthdev) return; if (!(synth_open_mask & (1 << dev))) return; @@ -1671,14 +1671,7 @@ void sequencer_init(void) void sequencer_unload(void) { - if(queue) - { - vfree(queue); - queue=NULL; - } - if(iqueue) - { - vfree(iqueue); - iqueue=NULL; - } + vfree(queue); + vfree(iqueue); + queue = iqueue = NULL; } diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 8a9917c9..3f7427c 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) in_use = 0; - data_buffer = (char *)kmalloc(BUFFER_SIZE, GFP_KERNEL); + data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL); if (data_buffer == NULL) return -ENOMEM; diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c index 69a4b87..42bd276 100644 --- a/sound/oss/sonicvibes.c +++ b/sound/oss/sonicvibes.c @@ -116,6 +116,7 @@ #include <linux/spinlock.h> #include <linux/smp_lock.h> #include <linux/gameport.h> +#include <linux/dma-mapping.h> #include <linux/mutex.h> @@ -407,24 +408,6 @@ static inline unsigned ld2(unsigned int x) return r; } -/* - * hweightN: returns the hamming weight (i.e. the number - * of bits set) of a N-bit word - */ - -#ifdef hweight32 -#undef hweight32 -#endif - -static inline unsigned int hweight32(unsigned int w) -{ - unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); - res = (res & 0x33333333) + ((res >> 2) & 0x33333333); - res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); - res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); - return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); -} - /* --------------------------------------------------------------------- */ /* @@ -2553,7 +2536,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id return -ENODEV; if (pcidev->irq == 0) return -ENODEV; - if (pci_set_dma_mask(pcidev, 0x00ffffff)) { + if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) { printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n"); return -ENODEV; } diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index dce9016..eb5ea32 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c @@ -154,8 +154,8 @@ static void start_adc(struct cs4297a_state *s); #if CSDEBUG static unsigned long cs_debuglevel = 4; // levels range from 1-9 static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/; -MODULE_PARM(cs_debuglevel, "i"); -MODULE_PARM(cs_debugmask, "i"); +module_param(cs_debuglevel, int, 0); +module_param(cs_debugmask, int, 0); #endif #define CS_TRUE 1 #define CS_FALSE 0 diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index b372e88..5f140c7 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c @@ -248,27 +248,6 @@ typedef struct lithium { } lithium_t; /* - * li_create initializes the lithium_t structure and sets up vm mappings - * to access the registers. - * Returns 0 on success, -errno on failure. - */ - -static int __init li_create(lithium_t *lith, unsigned long baseaddr) -{ - static void li_destroy(lithium_t *); - - spin_lock_init(&lith->lock); - lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE); - lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE); - lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE); - if (!lith->page0 || !lith->page1 || !lith->page2) { - li_destroy(lith); - return -ENOMEM; - } - return 0; -} - -/* * li_destroy destroys the lithium_t structure and vm mappings. */ @@ -289,6 +268,25 @@ static void li_destroy(lithium_t *lith) } /* + * li_create initializes the lithium_t structure and sets up vm mappings + * to access the registers. + * Returns 0 on success, -errno on failure. + */ + +static int __init li_create(lithium_t *lith, unsigned long baseaddr) +{ + spin_lock_init(&lith->lock); + lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE); + lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE); + lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE); + if (!lith->page0 || !lith->page1 || !lith->page2) { + li_destroy(lith); + return -ENOMEM; + } + return 0; +} + +/* * basic register accessors - read/write long/byte */ diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 99d04ad..afcb524 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c @@ -2028,8 +2028,8 @@ __setup("waveartist=", setup_waveartist); #endif MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver"); -MODULE_PARM(io, "i"); /* IO base */ -MODULE_PARM(irq, "i"); /* IRQ */ -MODULE_PARM(dma, "i"); /* DMA */ -MODULE_PARM(dma2, "i"); /* DMA2 */ +module_param(io, int, 0); /* IO base */ +module_param(irq, int, 0); /* IRQ */ +module_param(dma, int, 0); /* DMA */ +module_param(dma2, int, 0); /* DMA2 */ MODULE_LICENSE("GPL"); diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 2aa5a7f..c6c8333 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -39,6 +39,7 @@ #include <linux/interrupt.h> #include <linux/compiler.h> #include <linux/delay.h> +#include <linux/dma-mapping.h> #include <sound/driver.h> #include <sound/core.h> diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e264136..fc92b68 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -33,6 +33,7 @@ #include <linux/pci.h> #include <linux/slab.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/info.h> @@ -2220,8 +2221,8 @@ static int __devinit snd_ali_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 31 bits */ - if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 7b2ff5f..100d812 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -70,6 +70,7 @@ #include <linux/slab.h> #include <linux/gameport.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/rawmidi.h> @@ -688,8 +689,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, return err; } /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index e077eb3..680077e 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -104,6 +104,7 @@ #include <linux/slab.h> #include <linux/gameport.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/control.h> #include <sound/pcm.h> @@ -1669,8 +1670,8 @@ snd_azf3328_create(struct snd_card *card, chip->irq = -1; /* check if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); err = -ENXIO; goto out_err; diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 2208dbd..3e332f3 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -36,6 +36,7 @@ #include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/initval.h> #include <sound/pcm.h> diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 0d556b0..4d62fe4 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -55,6 +55,7 @@ #include <linux/gameport.h> #include <linux/moduleparam.h> #include <linux/delay.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/control.h> #include <sound/pcm.h> @@ -1517,8 +1518,8 @@ static int __devinit snd_es1938_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index dd465a1..e3ad17f 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -104,6 +104,7 @@ #include <linux/slab.h> #include <linux/gameport.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <linux/mutex.h> #include <sound/core.h> diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 672e198..b88eeba 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -56,7 +56,9 @@ #include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <linux/mutex.h> + #include <sound/core.h> #include <sound/cs8427.h> #include <sound/info.h> diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 8bc0849..44393e1 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -41,6 +41,7 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/info.h> #include <sound/control.h> diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 43ee3b2..b5a0950 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -28,6 +28,8 @@ #include <linux/dma-mapping.h> #include <linux/moduleparam.h> #include <linux/mutex.h> +#include <linux/dma-mapping.h> + #include <sound/core.h> #include <sound/initval.h> #include <sound/info.h> diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index f679779..35875c8 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -30,6 +30,7 @@ #include <linux/delay.h> #include <linux/moduleparam.h> #include <linux/mutex.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/initval.h> diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 0cbef5f..ab78544 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 } /* - * SPDIF I/O capabilites (half-duplex mode) + * SPDIF I/O capabilities (half-duplex mode) */ static struct snd_pcm_hardware snd_rme32_spdif_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | @@ -339,7 +339,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_info = { }; /* - * ADAT I/O capabilites (half-duplex mode) + * ADAT I/O capabilities (half-duplex mode) */ static struct snd_pcm_hardware snd_rme32_adat_info = { @@ -364,7 +364,7 @@ static struct snd_pcm_hardware snd_rme32_adat_info = }; /* - * SPDIF I/O capabilites (full-duplex mode) + * SPDIF I/O capabilities (full-duplex mode) */ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { .info = (SNDRV_PCM_INFO_MMAP | @@ -390,7 +390,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { }; /* - * ADAT I/O capabilites (full-duplex mode) + * ADAT I/O capabilities (full-duplex mode) */ static struct snd_pcm_hardware snd_rme32_adat_fd_info = { diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 0e694b0..6c2a9f4 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -359,7 +359,7 @@ snd_rme96_capture_copy(struct snd_pcm_substream *substream, } /* - * Digital output capabilites (S/PDIF) + * Digital output capabilities (S/PDIF) */ static struct snd_pcm_hardware snd_rme96_playback_spdif_info = { @@ -388,7 +388,7 @@ static struct snd_pcm_hardware snd_rme96_playback_spdif_info = }; /* - * Digital input capabilites (S/PDIF) + * Digital input capabilities (S/PDIF) */ static struct snd_pcm_hardware snd_rme96_capture_spdif_info = { @@ -417,7 +417,7 @@ static struct snd_pcm_hardware snd_rme96_capture_spdif_info = }; /* - * Digital output capabilites (ADAT) + * Digital output capabilities (ADAT) */ static struct snd_pcm_hardware snd_rme96_playback_adat_info = { @@ -442,7 +442,7 @@ static struct snd_pcm_hardware snd_rme96_playback_adat_info = }; /* - * Digital input capabilites (ADAT) + * Digital input capabilities (ADAT) */ static struct snd_pcm_hardware snd_rme96_capture_adat_info = { diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 980b9cd..b5538ef 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 } /* Channel playback mixer as default control - Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats to big for any alsamixer + Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats too big for any alsamixer they are accesible via special IOCTL on hwdep and the mixer 2dimensional mixer control */ diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 7bbea37..2d66a09 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -30,6 +30,7 @@ #include <linux/slab.h> #include <linux/gameport.h> #include <linux/moduleparam.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/pcm.h> @@ -1227,8 +1228,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 24 bits */ - if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 83b7d8a..52178b8 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -35,6 +35,7 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/gameport.h> +#include <linux/dma-mapping.h> #include <sound/core.h> #include <sound/info.h> @@ -3554,8 +3555,8 @@ int __devinit snd_trident_create(struct snd_card *card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 30 bits */ - if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { + if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) { snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index aa57170..f0794ef 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -869,7 +869,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) u32 layout_id = 0; - if (_machine != _MACH_Pmac) + if (!machine_is(powermac)) return -ENODEV; chip->subframe = 0; diff --git a/sound/sound_core.c b/sound/sound_core.c index 394b53e..6f84972 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c @@ -53,7 +53,7 @@ struct sound_unit { int unit_minor; - struct file_operations *unit_fops; + const struct file_operations *unit_fops; struct sound_unit *next; char name[32]; }; @@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class); * join into it. Called with the lock asserted */ -static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, struct file_operations *fops, int index, int low, int top) +static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, const struct file_operations *fops, int index, int low, int top) { int n=low; @@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock); * list. Acquires locks as needed */ -static 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) +static 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) { struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); int r; @@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP]; * a negative error code is returned. */ -int register_sound_special_device(struct file_operations *fops, int unit, +int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev) { const int chain = unit % SOUND_STEP; @@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit, EXPORT_SYMBOL(register_sound_special_device); -int register_sound_special(struct file_operations *fops, int unit) +int register_sound_special(const struct file_operations *fops, int unit) { return register_sound_special_device(fops, unit, NULL); } @@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special); * number is returned, on failure a negative error code is returned. */ -int register_sound_mixer(struct file_operations *fops, int dev) +int register_sound_mixer(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[0], fops, dev, 0, 128, "mixer", S_IRUSR | S_IWUSR, NULL); @@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer); * number is returned, on failure a negative error code is returned. */ -int register_sound_midi(struct file_operations *fops, int dev) +int register_sound_midi(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[2], fops, dev, 2, 130, "midi", S_IRUSR | S_IWUSR, NULL); @@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi); * and will always allocate them as a matching pair - eg dsp3/audio3 */ -int register_sound_dsp(struct file_operations *fops, int dev) +int register_sound_dsp(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[3], fops, dev, 3, 131, "dsp", S_IWUSR | S_IRUSR, NULL); @@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp); */ -int register_sound_synth(struct file_operations *fops, int dev) +int register_sound_synth(const struct file_operations *fops, int dev) { return sound_insert_unit(&chains[9], fops, dev, 9, 137, "synth", S_IRUSR | S_IWUSR, NULL); @@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file) int chain; int unit = iminor(inode); struct sound_unit *s; - struct file_operations *new_fops = NULL; + const struct file_operations *new_fops = NULL; chain=unit&0x0F; if(chain==4 || chain==5) /* dsp/audio/dsp16 */ @@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file) * switching ->f_op in the first place. */ int err = 0; - struct file_operations *old_fops = file->f_op; + const struct file_operations *old_fops = file->f_op; file->f_op = new_fops; spin_unlock(&sound_loader_lock); if(file->f_op->open) diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 53a148b..8804f26 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -611,8 +611,7 @@ static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, unsigned int period_size = snd_pcm_lib_period_bytes(substream); unsigned int offset = period_size * (*periods_sent); - if (period_size >= (1 << 24)) - BUG(); + BUG_ON(period_size >= (1 << 24)); if (dma_cont->request(dma_cont, runtime->dma_addr + offset, period_size)) return; @@ -1079,8 +1078,7 @@ static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream) chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); - if (runtime->period_size > 0xffff + 1) - BUG(); + BUG_ON(runtime->period_size > 0xffff + 1); chip->p_periods_sent = 0; spin_unlock_irqrestore(&chip->lock, flags); diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 3158550..fe67a92 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) struct usX2Ydev * usX2Y = subs->usX2Y; usX2Y->prepare_subs = subs; subs->urb[0]->start_frame = -1; - smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() + smp_wmb(); // Make sure above modifications are seen by i_usX2Y_subs_startup() usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); } |