Commit f96320c3 authored by James Bottomley's avatar James Bottomley

aha152x request region fix

Noticed by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Fixed By: Juergen E. Fischer <fischer@linux-buechse.de>

On Sat, Jan 24, 2004 at 15:02:12 +0100, Guennadi Liakhovetski wrote:
> Correct and forgive me if I am wrong, it looks like you are now poking at
> ports without requesting them - in *_porttest. Is it a good idea?

Ouch.  No, of course not, you are right.  Thanks for pointing.  I
thought I had moved the port testing to aha152x_probe_one...

Following patch cleans that up.

The port test during autoconfiguration was also done without requesting
the region first and there was a bug in auto configuration of a TC1550
controller (both even before the patch).
parent 4d5d8e2a
......@@ -3593,14 +3593,22 @@ static int checksetup(struct aha152x_setup *setup)
if (i == ARRAY_SIZE(ports))
return 0;
if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
return 0;
}
if( aha152x_porttest(setup->io_port) ) {
setup->tc1550=0;
} else if( tc1550_porttest(setup->io_port) ) {
setup->tc1550=1;
} else {
release_region(setup->io_port, IO_RANGE);
return 0;
}
release_region(setup->io_port, IO_RANGE);
if ((setup->irq < IRQ_MIN) || (setup->irq > IRQ_MAX))
return 0;
......@@ -3840,33 +3848,30 @@ static int __init aha152x_init(void)
if ((setup_count == 1) && (setup[0].io_port == ports[i]))
continue;
if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) {
printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
continue;
}
if (aha152x_porttest(ports[i])) {
ok++;
setup[setup_count].io_port = ports[i];
setup[setup_count].tc1550 = 0;
conf.cf_port =
(GETPORT(ports[i] + O_PORTA) << 8) + GETPORT(ports[i] + O_PORTB);
setup[setup_count].irq = IRQ_MIN + conf.cf_irq;
setup[setup_count].scsiid = conf.cf_id;
setup[setup_count].reconnect = conf.cf_tardisc;
setup[setup_count].parity = !conf.cf_parity;
setup[setup_count].synchronous = conf.cf_syncneg;
setup[setup_count].delay = DELAY_DEFAULT;
setup[setup_count].ext_trans = 0;
#if defined(AHA152X_DEBUG)
setup[setup_count].debug = DEBUG_DEFAULT;
#endif
setup_count++;
} else if (tc1550_porttest(ports[i])) {
ok++;
setup[setup_count].io_port = ports[i];
setup[setup_count].tc1550 = 1;
conf.cf_port =
(GETPORT(ports[i] + O_PORTA) << 8) + GETPORT(ports[i] + O_PORTB);
(GETPORT(ports[i] + O_TC_PORTA) << 8) + GETPORT(ports[i] + O_TC_PORTB);
} else {
release_region(ports[i], IO_RANGE);
continue;
}
release_region(ports[i], IO_RANGE);
ok++;
setup[setup_count].io_port = ports[i];
setup[setup_count].irq = IRQ_MIN + conf.cf_irq;
setup[setup_count].scsiid = conf.cf_id;
setup[setup_count].reconnect = conf.cf_tardisc;
......@@ -3878,7 +3883,7 @@ static int __init aha152x_init(void)
setup[setup_count].debug = DEBUG_DEFAULT;
#endif
setup_count++;
}
}
if (ok)
......
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