Commit 0a333133 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] check_region fixes

A couple of old ISA drivers had trivial to fix check_region() uses.
Sanitized.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4c7dea97
...@@ -41,9 +41,6 @@ static void __init attach_gus(struct address_info *hw_config) ...@@ -41,9 +41,6 @@ static void __init attach_gus(struct address_info *hw_config)
{ {
gus_wave_init(hw_config); gus_wave_init(hw_config);
request_region(hw_config->io_base, 16, "GUS");
request_region(hw_config->io_base + 0x100, 12, "GUS"); /* 0x10c-> is MAX */
if (sound_alloc_dma(hw_config->dma, "GUS")) if (sound_alloc_dma(hw_config->dma, "GUS"))
printk(KERN_ERR "gus_card.c: Can't allocate DMA channel %d\n", hw_config->dma); printk(KERN_ERR "gus_card.c: Can't allocate DMA channel %d\n", hw_config->dma);
if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma) if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
...@@ -73,11 +70,7 @@ static int __init probe_gus(struct address_info *hw_config) ...@@ -73,11 +70,7 @@ static int __init probe_gus(struct address_info *hw_config)
printk(KERN_ERR "GUS: Unsupported IRQ %d\n", irq); printk(KERN_ERR "GUS: Unsupported IRQ %d\n", irq);
return 0; return 0;
} }
if (check_region(hw_config->io_base, 16)) if (gus_wave_detect(hw_config->io_base))
printk(KERN_ERR "GUS: I/O range conflict (1)\n");
else if (check_region(hw_config->io_base + 0x100, 16))
printk(KERN_ERR "GUS: I/O range conflict (2)\n");
else if (gus_wave_detect(hw_config->io_base))
return 1; return 1;
#ifndef EXCLUDE_GUS_IODETECT #ifndef EXCLUDE_GUS_IODETECT
...@@ -86,17 +79,14 @@ static int __init probe_gus(struct address_info *hw_config) ...@@ -86,17 +79,14 @@ static int __init probe_gus(struct address_info *hw_config)
* Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6) * Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6)
*/ */
for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10) for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10) {
if (io_addr != hw_config->io_base) /* if (io_addr == hw_config->io_base) /* Already tested */
* Already tested continue;
*/ if (gus_wave_detect(io_addr)) {
if (!check_region(io_addr, 16)) hw_config->io_base = io_addr;
if (!check_region(io_addr + 0x100, 16)) return 1;
if (gus_wave_detect(io_addr)) }
{ }
hw_config->io_base = io_addr;
return 1;
}
#endif #endif
printk("NO GUS card found !\n"); printk("NO GUS card found !\n");
......
...@@ -978,6 +978,13 @@ int __init gus_wave_detect(int baseaddr) ...@@ -978,6 +978,13 @@ int __init gus_wave_detect(int baseaddr)
unsigned long loc; unsigned long loc;
unsigned char val; 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_base = baseaddr;
gus_write8(0x4c, 0); /* Reset GF1 */ gus_write8(0x4c, 0); /* Reset GF1 */
...@@ -1015,8 +1022,11 @@ int __init gus_wave_detect(int baseaddr) ...@@ -1015,8 +1022,11 @@ int __init gus_wave_detect(int baseaddr)
/* See if there is first block there.... */ /* See if there is first block there.... */
gus_poke(0L, 0xaa); gus_poke(0L, 0xaa);
if (gus_peek(0L) != 0xaa) if (gus_peek(0L) != 0xaa) {
return (0); release_region(baseaddr + 0x100, 12);
release_region(baseaddr, 16);
return 0;
}
/* Now zero it out so that I can check for mirroring .. */ /* Now zero it out so that I can check for mirroring .. */
gus_poke(0L, 0x00); gus_poke(0L, 0x00);
......
...@@ -1145,11 +1145,10 @@ static int __init probe_multisound(void) ...@@ -1145,11 +1145,10 @@ static int __init probe_multisound(void)
char *pinfiji = "Pinnacle/Fiji"; char *pinfiji = "Pinnacle/Fiji";
#endif #endif
if (check_region(dev.io, dev.numio)) { if (!request_region(dev.io, dev.numio, "probing")) {
printk(KERN_ERR LOGNAME ": I/O port conflict\n"); printk(KERN_ERR LOGNAME ": I/O port conflict\n");
return -ENODEV; return -ENODEV;
} }
request_region(dev.io, dev.numio, "probing");
if (reset_dsp() < 0) { if (reset_dsp() < 0) {
release_region(dev.io, dev.numio); release_region(dev.io, dev.numio);
...@@ -1833,12 +1832,11 @@ static int __init msnd_init(void) ...@@ -1833,12 +1832,11 @@ static int __init msnd_init(void)
/* Joystick */ /* Joystick */
pinnacle_devs[3].io0 = joystick_io; pinnacle_devs[3].io0 = joystick_io;
if (check_region(cfg, 2)) { if (!request_region(cfg, 2, "Pinnacle/Fiji Config")) {
printk(KERN_ERR LOGNAME ": Config port 0x%x conflict\n", cfg); printk(KERN_ERR LOGNAME ": Config port 0x%x conflict\n", cfg);
return -EIO; return -EIO;
} }
request_region(cfg, 2, "Pinnacle/Fiji Config");
if (msnd_pinnacle_cfg_devices(cfg, reset, pinnacle_devs)) { if (msnd_pinnacle_cfg_devices(cfg, reset, pinnacle_devs)) {
printk(KERN_ERR LOGNAME ": Device configuration error\n"); printk(KERN_ERR LOGNAME ": Device configuration error\n");
release_region(cfg, 2); release_region(cfg, 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment