Commit 15377d7c authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] fix up opti92x-ad1848

parent 9b88b133
...@@ -326,11 +326,11 @@ static char * snd_opti9xx_names[] = { ...@@ -326,11 +326,11 @@ static char * snd_opti9xx_names[] = {
static long snd_legacy_find_free_ioport(long *port_table, long size) static long snd_legacy_find_free_ioport(long *port_table, long size)
{ {
while (*port_table != -1) { while (*port_table != -1) {
if (!check_region(*port_table, size)) if (request_region(*port_table, size, "opti92x-ad1848"))
return *port_table; return *port_table;
port_table++; port_table++;
} }
return -1; return SNDRV_AUTO_PORT;
} }
static int __init snd_opti9xx_init(opti9xx_t *chip, unsigned short hardware) static int __init snd_opti9xx_init(opti9xx_t *chip, unsigned short hardware)
...@@ -1917,6 +1917,10 @@ static void snd_card_opti9xx_free(snd_card_t *card) ...@@ -1917,6 +1917,10 @@ static void snd_card_opti9xx_free(snd_card_t *card)
#ifdef __ISAPNP__ #ifdef __ISAPNP__
snd_card_opti9xx_deactivate(chip); snd_card_opti9xx_deactivate(chip);
#endif /* __ISAPNP__ */ #endif /* __ISAPNP__ */
if (chip->wss_base != SNDRV_AUTO_PORT)
release_region(chip->wss_base, 4);
if (chip->mpu_port != SNDRV_AUTO_PORT)
release_region(chip->mpu_port, 2);
if (chip->res_mc_base) { if (chip->res_mc_base) {
release_resource(chip->res_mc_base); release_resource(chip->res_mc_base);
kfree_nocheck(chip->res_mc_base); kfree_nocheck(chip->res_mc_base);
...@@ -1962,6 +1966,16 @@ static int __init snd_card_opti9xx_probe(void) ...@@ -1962,6 +1966,16 @@ static int __init snd_card_opti9xx_probe(void)
card->private_free = snd_card_opti9xx_free; card->private_free = snd_card_opti9xx_free;
chip = (opti9xx_t *)card->private_data; chip = (opti9xx_t *)card->private_data;
chip->wss_base = port;
chip->fm_port = fm_port;
chip->mpu_port = mpu_port;
chip->irq = irq;
chip->mpu_irq = mpu_irq;
chip->dma1 = dma1;
#if defined(CS4231) || defined(OPTi93X)
chip->dma2 = dma2;
#endif
#ifdef __ISAPNP__ #ifdef __ISAPNP__
if (isapnp && (hw = snd_card_opti9xx_isapnp(chip)) > 0) { if (isapnp && (hw = snd_card_opti9xx_isapnp(chip)) > 0) {
switch (hw) { switch (hw) {
...@@ -2000,28 +2014,18 @@ static int __init snd_card_opti9xx_probe(void) ...@@ -2000,28 +2014,18 @@ static int __init snd_card_opti9xx_probe(void)
return -ENOMEM; return -ENOMEM;
} }
chip->wss_base = port;
chip->fm_port = fm_port;
chip->mpu_port = mpu_port;
chip->irq = irq;
chip->mpu_irq = mpu_irq;
chip->dma1 = dma1;
#if defined(CS4231) || defined(OPTi93X)
chip->dma2 = dma2;
#endif
#ifdef __ISAPNP__ #ifdef __ISAPNP__
if (!isapnp) { if (!isapnp) {
#endif #endif
if (chip->wss_base == SNDRV_AUTO_PORT) { if (chip->wss_base == SNDRV_AUTO_PORT) {
if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) { if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) == SNDRV_AUTO_PORT) {
snd_card_free(card); snd_card_free(card);
snd_printk("unable to find a free WSS port\n"); snd_printk("unable to find a free WSS port\n");
return -EBUSY; return -EBUSY;
} }
} }
if (chip->mpu_port == SNDRV_AUTO_PORT) { if (chip->mpu_port == SNDRV_AUTO_PORT) {
if ((chip->mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { if ((chip->mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) == SNDRV_AUTO_PORT) {
snd_card_free(card); snd_card_free(card);
snd_printk("unable to find a free MPU401 port\n"); snd_printk("unable to find a free MPU401 port\n");
return -EBUSY; return -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment