Skip to contentSkip to conversation

Serial double initialisation

CFT Russell King 2 participants 2 messages Nov 30, 2002 – Dec 1, 2002

lore
Share & tools
lore
#0 lore raw

A while ago, Alan reported to me a double-initialisation bug between the ISA init and PNP initialisation of serial ports.

Since then, Alan integrated a patch I sent him into -ac, and as yet I haven't heard any feedback. Since I don't have the PNP hardware to be able to test this, I'm not putting it into Linus' tree until I hear some success.

So, if people are using 2.5.50 with PNP support enabled, and if you are seeing two "ttyS0" lines during the kernel boot messages, please apply this patch and confirm to me that it correctly reports one ttyS0 message.

This is the exact same patch I sent to Alan, and appears to apply cleanly to the current 2.5.50 BK tree.

Hopefully looking forward to some feedback.

Thanks.

drivers/serial/core.c +15 -10
@@ -2405,17 +2405,22 @@
 			goto out;
 		}
 
-		state->port->iobase   = port->iobase;
-		state->port->membase  = port->membase;
-		state->port->irq      = port->irq;
-		state->port->uartclk  = port->uartclk;
-		state->port->fifosize = port->fifosize;
-		state->port->regshift = port->regshift;
-		state->port->iotype   = port->iotype;
-		state->port->flags    = port->flags;
-		state->port->line     = state - drv->state;
+		/*
+		 * If the port is already initialised, don't touch it.
+		 */
+		if (state->port->type == PORT_UNKNOWN) {
+			state->port->iobase   = port->iobase;
+			state->port->membase  = port->membase;
+			state->port->irq      = port->irq;
+			state->port->uartclk  = port->uartclk;
+			state->port->fifosize = port->fifosize;
+			state->port->regshift = port->regshift;
+			state->port->iotype   = port->iotype;
+			state->port->flags    = port->flags;
+			state->port->line     = state - drv->state;
 
-		__uart_register_port(drv, state, state->port);
+			__uart_register_port(drv, state, state->port);
+		}
 
 		ret = state->port->line;
 	} else
Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#1 lore raw
Quoted 11 lines · Russell King

A while ago, Alan reported to me a double-initialisation bug between the ISA init and PNP initialisation of serial ports.

Since then, Alan integrated a patch I sent him into -ac, and as yet I haven't heard any feedback. Since I don't have the PNP hardware to be able to test this, I'm not putting it into Linus' tree until I hear some success.

So, if people are using 2.5.50 with PNP support enabled, and if you are seeing two "ttyS0" lines during the kernel boot messages, please apply this patch and confirm to me that it correctly reports one ttyS0 message.

Thanks for checking this out, the double init only comes when you have CONFIG_PNPBIOS enabled, but CONFIG_ISAPNP alone is fine. I tested the patch with both and it does indeed fix the problem.

Cheers,
Zwane

Signature · 1 line
function.linuxpower.ca