Commit a99582a7 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] soundblaster check_region() removal

moved request_region() to callers of sb_dsp_...()
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 43d16e46
......@@ -156,10 +156,14 @@ static int __devinit probe_one(struct pci_dev *pdev, const struct pci_device_id
hw_config->dma2 = dma16;
hw_config->name = "Cyrix XpressAudio";
hw_config->driver_use_1 = SB_NO_MIDI | SB_PCI_IRQ;
if (!request_region(io, 16, "soundblaster"))
goto err_out_free;
if(sb_dsp_detect(hw_config, 0, 0, NULL)==0)
{
printk(KERN_ERR "kahlua: audio not responding.\n");
release_region(io, 16);
goto err_out_free;
}
......
......@@ -732,8 +732,12 @@ static int __init probe_mad16_mpu(struct address_info *hw_config)
mad_write(MC3_PORT, tmp | 0x04);
hw_config->driver_use_1 = SB_MIDI_ONLY;
if (!sb_dsp_detect(hw_config, 0, 0, NULL))
if (!request_region(hw_config->io_base, 16, "soundblaster"))
return 0;
if (!sb_dsp_detect(hw_config, 0, 0, NULL)) {
release_region(hw_config->io_base, 16);
return 0;
}
if (mad_read(MC1_PORT) & 0x20)
hw_config->io_base = 0x240;
......
......@@ -100,7 +100,14 @@ MODULE_PARM_DESC(uart401, "When set to 1, will attempt to detect and enable"\
/* OSS subsystem card registration shared by PnP and legacy routines */
static int sb_register_oss(struct sb_card_config *scc, struct sb_module_options *sbmo)
{
if(!sb_dsp_detect(&scc->conf, 0, 0, sbmo)) {
if (!request_region(scc->conf.io_base, 16, "soundblaster")) {
printk(KERN_ERR "sb: ports busy.\n");
kfree(scc);
return -EBUSY;
}
if (!sb_dsp_detect(&scc->conf, 0, 0, sbmo)) {
release_region(scc->conf.io_base, 16);
printk(KERN_ERR "sb: Failed DSP Detect.\n");
kfree(scc);
return -ENODEV;
......
......@@ -520,13 +520,6 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
*/
DDB(printk("sb_dsp_detect(%x) entered\n", hw_config->io_base));
if (check_region(hw_config->io_base, 16))
{
#ifdef MODULE
printk(KERN_INFO "sb: I/O region in use.\n");
#endif
return 0;
}
devc->lock = SPIN_LOCK_UNLOCKED;
devc->type = hw_config->card_subtype;
......@@ -668,6 +661,7 @@ int sb_dsp_init(struct address_info *hw_config, struct module *owner)
if (devc->base != hw_config->io_base)
{
DDB(printk("I/O port mismatch\n"));
release_region(devc->base, 16);
return 0;
}
/*
......@@ -689,6 +683,7 @@ int sb_dsp_init(struct address_info *hw_config, struct module *owner)
if (request_irq(hw_config->irq, sbintr, i, "soundblaster", devc) < 0)
{
printk(KERN_ERR "SB: Can't allocate IRQ%d\n", hw_config->irq);
release_region(devc->base, 16);
return 0;
}
devc->irq_ok = 0;
......@@ -697,6 +692,7 @@ int sb_dsp_init(struct address_info *hw_config, struct module *owner)
if (!sb16_set_irq_hw(devc, devc->irq)) /* Unsupported IRQ */
{
free_irq(devc->irq, devc);
release_region(devc->base, 16);
return 0;
}
if ((devc->type == 0 || devc->type == MDL_ESS) &&
......@@ -735,7 +731,6 @@ int sb_dsp_init(struct address_info *hw_config, struct module *owner)
}
}
} /* IRQ setup */
request_region(hw_config->io_base, 16, "soundblaster");
last_sb = devc;
......
......@@ -276,6 +276,8 @@ static int __init probe_trix_sb(struct address_info *hw_config)
int tmp;
unsigned char conf;
extern int sb_be_quiet;
int old_quiet;
static signed char irq_translate[] = {
-1, -1, -1, 0, 1, 2, -1, 3
};
......@@ -289,11 +291,6 @@ static int __init probe_trix_sb(struct address_info *hw_config)
if (sb_initialized)
return 0;
if (check_region(hw_config->io_base, 16))
{
printk(KERN_ERR "AudioTrix: SB I/O port conflict (%x)\n", hw_config->io_base);
return 0;
}
if ((hw_config->io_base & 0xffffff8f) != 0x200)
return 0;
......@@ -307,6 +304,11 @@ static int __init probe_trix_sb(struct address_info *hw_config)
if (tmp != 1 && tmp != 3)
return 0;
if (!request_region(hw_config->io_base, 16, "soundblaster")) {
printk(KERN_ERR "AudioTrix: SB I/O port conflict (%x)\n", hw_config->io_base);
return 0;
}
conf = 0x84; /* DMA and IRQ enable */
conf |= hw_config->io_base & 0x70; /* I/O address bits */
conf |= irq_translate[hw_config->irq];
......@@ -318,13 +320,10 @@ static int __init probe_trix_sb(struct address_info *hw_config)
sb_initialized = 1;
hw_config->name = "AudioTrix SB";
return sb_dsp_detect(hw_config, 0, 0, NULL);
}
static void __init attach_trix_sb(struct address_info *hw_config)
{
extern int sb_be_quiet;
int old_quiet;
if (!sb_dsp_detect(hw_config, 0, 0, NULL)) {
release_region(hw_config->io_base, 16);
return 0;
}
hw_config->driver_use_1 = SB_NO_MIDI | SB_NO_MIXER | SB_NO_RECORDING;
......@@ -335,6 +334,7 @@ static void __init attach_trix_sb(struct address_info *hw_config)
sb_dsp_init(hw_config, THIS_MODULE);
sb_be_quiet = old_quiet;
return 1;
}
static int __init probe_trix_mpu(struct address_info *hw_config)
......@@ -496,8 +496,6 @@ static int __init init_trix(void)
if (cfg2.io_base != -1) {
sb = probe_trix_sb(&cfg2);
if (sb)
attach_trix_sb(&cfg2);
}
if (cfg_mpu.io_base != -1)
......
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