PATCH: fix up opti92x-ad1848

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Fri Mar 21 2003 - 15:07:26 EST


diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.65/sound/isa/opti9xx/opti92x-ad1848.c linux-2.5.65-ac2/sound/isa/opti9xx/opti92x-ad1848.c
--- linux-2.5.65/sound/isa/opti9xx/opti92x-ad1848.c 2003-02-10 18:38:00.000000000 +0000
+++ linux-2.5.65-ac2/sound/isa/opti9xx/opti92x-ad1848.c 2003-03-06 23:59:15.000000000 +0000
@@ -326,11 +326,11 @@
 static long snd_legacy_find_free_ioport(long *port_table, long size)
 {
         while (*port_table != -1) {
- if (!check_region(*port_table, size))
+ if (request_region(*port_table, size, "opti92x-ad1848"))
                         return *port_table;
                 port_table++;
         }
- return -1;
+ return SNDRV_AUTO_PORT;
 }
 
 static int __init snd_opti9xx_init(opti9xx_t *chip, unsigned short hardware)
@@ -1914,6 +1914,10 @@
 #ifdef __ISAPNP__
                 snd_card_opti9xx_deactivate(chip);
 #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) {
                         release_resource(chip->res_mc_base);
                         kfree_nocheck(chip->res_mc_base);
@@ -1959,6 +1963,16 @@
         card->private_free = snd_card_opti9xx_free;
         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__
         if (isapnp && (hw = snd_card_opti9xx_isapnp(chip)) > 0) {
                 switch (hw) {
@@ -1997,28 +2011,18 @@
                 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__
         if (!isapnp) {
 #endif
         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_printk("unable to find a free WSS port\n");
                         return -EBUSY;
                 }
         }
         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_printk("unable to find a free MPU401 port\n");
                         return -EBUSY;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:37 EST