patch-2.1.72 linux/drivers/char/serial.c

Next file: linux/drivers/char/softdog.c
Previous file: linux/drivers/char/rtc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.71/linux/drivers/char/serial.c linux/drivers/char/serial.c
@@ -3522,8 +3522,9 @@
  *	Setup initial baud/bits/parity. We do two things here:
  *	- construct a cflag setting for the first rs_open()
  *	- initialize the serial port
+ *	Return non-zero if we didn't find a serial port.
  */
-__initfunc(static void serial_console_setup(struct console *co, char *options))
+__initfunc(static int serial_console_setup(struct console *co, char *options))
 {
 	struct serial_state *ser;
 	unsigned cval;
@@ -3619,6 +3620,12 @@
 	outb(quot >> 8, ser->port + UART_DLM);		/* MS of divisor */
 	outb(cval, ser->port + UART_LCR);		/* reset DLAB */
 
+	/*
+	 *	If we read 0xff from the LSR, there is no UART here.
+	 */
+	if (inb(ser->port + UART_LSR) == 0xff)
+		return -1;
+	return 0;
 }
 
 static struct console sercons = {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov