[PATCH] CPM_UART: Fix non-console initialisation

kalle.pokki at iki.fi kalle.pokki at iki.fi
Thu Oct 19 22:31:10 EST 2006


If there is a frame buffer console, the cpm_uart_init_portdesc()
function is never called in the compat mode. Also, the set_lineif()
method is not called in the compat mode.

Signed-off-by: Kalle Pokki <kalle.pokki at iki.fi>
---
  drivers/serial/cpm_uart/cpm_uart.h      |    2 +-
  drivers/serial/cpm_uart/cpm_uart_core.c |    9 ++++-----
  drivers/serial/cpm_uart/cpm_uart_cpm1.c |    6 +++++-
  drivers/serial/cpm_uart/cpm_uart_cpm2.c |    6 +++++-
  4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index 3b35cb7..19a6ffe 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -89,7 +89,7 @@ extern struct uart_cpm_port cpm_uart_por

  /* these are located in their respective files */
  void cpm_line_cr_cmd(int line, int cmd);
-int cpm_uart_init_portdesc(void);
+int __init cpm_uart_init_portdesc(void);
  int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
  void cpm_uart_freebuf(struct uart_cpm_port *pinfo);

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 8f3b3e5..895f2f1 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1349,11 +1349,8 @@ static int cpm_uart_init(void) {
  		pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n");
  		pr_info(
  		"cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n");
-#ifndef CONFIG_SERIAL_CPM_CONSOLE
-		ret = cpm_uart_init_portdesc();
-		if (ret)
-			return ret;
-#endif
+
+		cpm_uart_init_portdesc();

  		cpm_reg.nr = cpm_uart_nr;
  		ret = uart_register_driver(&cpm_reg);
@@ -1365,6 +1362,8 @@ #endif
  			int con = cpm_uart_port_map[i];
  			cpm_uart_ports[con].port.line = i;
  			cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF;
+			if (cpm_uart_ports[con].set_lineif)
+				cpm_uart_ports[con].set_lineif(&cpm_uart_ports[con]);
  			uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port);
  		}

diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 95afc37..6f04a9f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -184,10 +184,14 @@ void cpm_uart_freebuf(struct uart_cpm_po
  }

  /* Setup any dynamic params in the uart desc */
-int cpm_uart_init_portdesc(void)
+int __init cpm_uart_init_portdesc(void)
  {
  	pr_debug("CPM uart[-]:init portdesc\n");

+	/* Don't run this again, if the console driver did it already */
+	if (cpm_uart_nr > 0)
+		return 0;
+
  	cpm_uart_nr = 0;
  #ifdef CONFIG_SERIAL_CPM_SMC1
  	cpm_uart_ports[UART_SMC1].smcp = &cpmp->cp_smc[0];
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index ef3bb47..0f21543 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -252,10 +252,14 @@ void cpm_uart_freebuf(struct uart_cpm_po
  }

  /* Setup any dynamic params in the uart desc */
-int cpm_uart_init_portdesc(void)
+int __init cpm_uart_init_portdesc(void)
  {
  	pr_debug("CPM uart[-]:init portdesc\n");

+	/* Don't run this again, if the console driver did it already */
+	if (cpm_uart_nr > 0)
+		return 0;
+
  	cpm_uart_nr = 0;
  #ifdef CONFIG_SERIAL_CPM_SMC1
  	cpm_uart_ports[UART_SMC1].smcp = (smc_t *) & cpm2_immr->im_smc[0];
-- 
1.4.1.1




More information about the Linuxppc-embedded mailing list