unsigned long loc;
unsigned char val;
+ if (!request_region(baseaddr, 16, "GUS"))
+ return 0;
+ if (!request_region(baseaddr + 0x100, 12, "GUS")) { /* 0x10c-> is MAX */
+ release_region(baseaddr, 16);
+ return 0;
+ }
+
gus_base = baseaddr;
gus_write8(0x4c, 0); /* Reset GF1 */
/* See if there is first block there.... */
gus_poke(0L, 0xaa);
- if (gus_peek(0L) != 0xaa)
- return (0);
+ if (gus_peek(0L) != 0xaa) {
+ release_region(baseaddr + 0x100, 12);
+ release_region(baseaddr, 16);
+ return 0;
+ }
/* Now zero it out so that I can check for mirroring .. */
gus_poke(0L, 0x00);
}
else
{
+ struct resource *ports;
+ ports = request_region(gus_base + 0x10c, 4, "ad1848");
model_num = "MAX";
gus_type = 0x40;
mixer_type = CS4231;
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;
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 */
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