ALSA: isa: Move snd_legacy_find_free_ioport to initval.h
authorOndrej Zary <linux@rainbow-software.org>
Wed, 1 Aug 2012 14:05:39 +0000 (16:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 3 Aug 2012 10:57:44 +0000 (12:57 +0200)
Move snd_legacy_find_free_ioport() function back to initval.h as it is used
by two drivers.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/initval.h
sound/isa/opti9xx/miro.c
sound/isa/opti9xx/opti92x-ad1848.c

index f99a0d2ddfe7b9e4e099fc386161be546a08fca4..ac62c67e6f4273ce361dd8b216b2cf05a07583e0 100644 (file)
 #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
 #define SNDRV_DEFAULT_PTR      SNDRV_DEFAULT_STR
 
+#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
+static long snd_legacy_find_free_ioport(long *port_table, long size)
+{
+       while (*port_table != -1) {
+               if (request_region(*port_table, size, "ALSA test")) {
+                       release_region(*port_table, size);
+                       return *port_table;
+               }
+               port_table++;
+       }
+       return -1;
+}
+#endif
+
 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
 #include <linux/interrupt.h>
 
index c24594c866f458adbcdd155e025d4f2ba9c78ebf..3d1afb612b3548ade1db68d1b60af8f3e7e6ce4b 100644 (file)
@@ -37,6 +37,7 @@
 #include <sound/opl4.h>
 #include <sound/control.h>
 #include <sound/info.h>
+#define SNDRV_LEGACY_FIND_FREE_IOPORT
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
 #include <sound/initval.h>
@@ -770,20 +771,6 @@ static int __devinit snd_miro_mixer(struct snd_card *card,
        return 0;
 }
 
-static long snd_legacy_find_free_ioport(long *port_table, long size)
-{
-       while (*port_table != -1) {
-               struct resource *res;
-               if ((res = request_region(*port_table, size, 
-                                         "ALSA test")) != NULL) {
-                       release_and_free_resource(res);
-                       return *port_table;
-               }
-               port_table++;
-       }
-       return -1;
-}
-
 static int __devinit snd_miro_init(struct snd_miro *chip,
                                   unsigned short hardware)
 {
index f8fbe22515c99b627885fa3c05da815514777f4e..2899c9fd1ceb4c12a34d01d714ec1bd3d4e74767 100644 (file)
@@ -39,6 +39,7 @@
 #ifndef OPTi93X
 #include <sound/opl4.h>
 #endif
+#define SNDRV_LEGACY_FIND_FREE_IOPORT
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
 #include <sound/initval.h>
@@ -185,19 +186,6 @@ static char * snd_opti9xx_names[] = {
        "82C930",       "82C931",       "82C933"
 };
 
-
-static long __devinit snd_legacy_find_free_ioport(long *port_table, long size)
-{
-       while (*port_table != -1) {
-               if (request_region(*port_table, size, "ALSA test")) {
-                       release_region(*port_table, size);
-                       return *port_table;
-               }
-               port_table++;
-       }
-       return -1;
-}
-
 static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
                                      unsigned short hardware)
 {