vserver 1.9.3
[linux-2.6.git] / sound / oss / gus_wave.c
index ed7333c..2cc924d 100644 (file)
@@ -2942,6 +2942,8 @@ void __init gus_wave_init(struct address_info *hw_config)
                }
                else
                {
+                       struct resource *ports;
+                       ports = request_region(gus_base + 0x10c, 4, "ad1848");
                        model_num = "MAX";
                        gus_type = 0x40;
                        mixer_type = CS4231;
@@ -2963,7 +2965,10 @@ void __init gus_wave_init(struct address_info *hw_config)
                                outb((max_config), gus_base + 0x106);   /* UltraMax control */
                        }
 
-                       if (ad1848_detect(gus_base + 0x10c, &ad_flags, hw_config->osp))
+                       if (!ports)
+                               goto no_cs4231;
+
+                       if (ad1848_detect(ports, &ad_flags, hw_config->osp))
                        {
                                char           *name = "GUS MAX";
                                int             old_num_mixers = num_mixers;
@@ -2977,7 +2982,7 @@ void __init gus_wave_init(struct address_info *hw_config)
                                if (hw_config->name)
                                        name = hw_config->name;
 
-                               hw_config->slots[1] = ad1848_init(name, gus_base + 0x10c,
+                               hw_config->slots[1] = ad1848_init(name, ports,
                                                        -irq, gus_dma2, /* Playback DMA */
                                                        gus_dma,        /* Capture DMA */
                                                        1,              /* Share DMA channels with GF1 */
@@ -2992,8 +2997,11 @@ void __init gus_wave_init(struct address_info *hw_config)
                                        AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_LINE);
                                }
                        }
-                       else
+                       else {
+                               release_region(gus_base + 0x10c, 4);
+                       no_cs4231:
                                printk(KERN_WARNING "GUS: No CS4231 ??");
+                       }
 #else
                        printk(KERN_ERR "GUS MAX found, but not compiled in\n");
 #endif