#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>
 
 
 #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>
        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)
 {
 
 #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>
        "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)
 {