X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fcs4232.c;h=de40e21bf2798c6d248de7f8dbf6d0fc643cf0ab;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=1d0f6edc21ae1ca0634d7adc5a21f40528edda48;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c index 1d0f6edc2..de40e21bf 100644 --- a/sound/oss/cs4232.c +++ b/sound/oss/cs4232.c @@ -47,14 +47,12 @@ * Marcus Meissner Added ISA PnP support. */ -#include #include #include #include #include "sound_config.h" -#include "cs4232.h" #include "ad1848.h" #include "mpu401.h" @@ -78,7 +76,7 @@ static int mpu_base, mpu_irq; static int synth_base, synth_irq; static int mpu_detected; -int probe_cs4232_mpu(struct address_info *hw_config) +static int probe_cs4232_mpu(struct address_info *hw_config) { /* * Just write down the config values. @@ -196,10 +194,12 @@ static int __init probe_cs4232(struct address_info *hw_config, int isapnp_config CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */ CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */ - if (check_region(0x388, 4)) /* Not free */ + if (!request_region(0x388, 4, "FM")) /* Not free */ CS_OUT3(0x48, 0x00, 0x00) /* FM base off */ - else + else { + release_region(0x388, 4); CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */ + } CS_OUT3(0x42, 0x00, 0x00); /* SB base off */ CS_OUT2(0x22, irq); /* SB+WSS IRQ */ @@ -359,29 +359,31 @@ 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"); -MODULE_PARM(io,"i"); +module_param(io, int, 0); MODULE_PARM_DESC(io,"base I/O port for AD1848"); -MODULE_PARM(irq,"i"); +module_param(irq, int, 0); MODULE_PARM_DESC(irq,"IRQ for AD1848 chip"); -MODULE_PARM(dma,"i"); +module_param(dma, int, 0); MODULE_PARM_DESC(dma,"8 bit DMA for AD1848 chip"); -MODULE_PARM(dma2,"i"); +module_param(dma2, int, 0); MODULE_PARM_DESC(dma2,"16 bit DMA for AD1848 chip"); -MODULE_PARM(mpuio,"i"); +module_param(mpuio, int, 0); MODULE_PARM_DESC(mpuio,"MPU 401 base address"); -MODULE_PARM(mpuirq,"i"); +module_param(mpuirq, int, 0); MODULE_PARM_DESC(mpuirq,"MPU 401 IRQ"); -MODULE_PARM(synthio,"i"); +module_param(synthio, int, 0); MODULE_PARM_DESC(synthio,"Maui WaveTable base I/O port"); -MODULE_PARM(synthirq,"i"); +module_param(synthirq, int, 0); MODULE_PARM_DESC(synthirq,"Maui WaveTable IRQ"); -MODULE_PARM(isapnp,"i"); +module_param(isapnp, bool, 0); MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)"); -MODULE_PARM(bss,"i"); +module_param(bss, bool, 0); MODULE_PARM_DESC(bss,"Enable Bose Sound System Support (default 0)"); /* @@ -402,11 +404,11 @@ static const struct pnp_device_id cs4232_pnp_table[] = { MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table); -static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) +static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct address_info *isapnpcfg; - isapnpcfg=(struct address_info*)kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); + isapnpcfg = kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); if (!isapnpcfg) return -ENOMEM; @@ -420,6 +422,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; } @@ -454,10 +457,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) { @@ -502,7 +506,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);