LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Pokki <kalle.pokki@iki.fi>
To: linuxppc-embedded@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	Vitaly Bordug <vbordug@ru.mvista.com>
Subject: [PATCH] CPM_UART: Fix non-console initialisation (v2)
Date: Wed, 1 Nov 2006 15:08:13 +0200 (EET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0611011457490.3387@host32.eke.fi> (raw)

This is a cleaned-up version of a patch sent on Oct 19th. The patch is 
fairly straightforward and does not affect other than the compat mode. As 
not having this patch renders the cpm_uart driver unusable with a frame 
buffer console, I think this should be included in 2.6.19.

---
The cpm_uart driver is initialised incorrectly, if there is a frame buffer
console, and CONFIG_SERIAL_CPM_CONSOLE is defined. The driver fails to 
call cpm_uart_init_portdesc() and set_lineif() in this case.

Signed-off-by: Kalle Pokki <kalle.pokki@iki.fi>
---
  drivers/serial/cpm_uart/cpm_uart.h      |    2 +-
  drivers/serial/cpm_uart/cpm_uart_core.c |   11 ++++++-----
  drivers/serial/cpm_uart/cpm_uart_cpm1.c |    2 +-
  drivers/serial/cpm_uart/cpm_uart_cpm2.c |    2 +-
  4 files changed, 9 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..4047530 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1349,11 +1349,10 @@ 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
+
+		/* Don't run this again, if the console driver did it already */
+		if (cpm_uart_nr == 0)
+			cpm_uart_init_portdesc();

  		cpm_reg.nr = cpm_uart_nr;
  		ret = uart_register_driver(&cpm_reg);
@@ -1365,6 +1364,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..08e55fd 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -184,7 +184,7 @@ 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");

diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index ef3bb47..b392aea 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -252,7 +252,7 @@ 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");

-- 
1.4.1.1

             reply	other threads:[~2006-11-01 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 13:08 Kalle Pokki [this message]
2006-11-01 13:47 ` [PATCH] CPM_UART: Fix non-console initialisation (v2) Vitaly Bordug
2006-11-10 10:29 ` Paul Mackerras
2006-11-10 11:45   ` Kalle Pokki
2006-11-10 12:02     ` Kalle Pokki
2006-11-11 11:29       ` Paul Mackerras
2006-11-11 14:15         ` Kalle Pokki
2006-11-13  8:22         ` Vitaly Bordug
2006-11-13  9:54           ` Paul Mackerras
2006-11-13 11:01             ` Kalle Pokki
2006-11-13 18:45             ` Vitaly Bordug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0611011457490.3387@host32.eke.fi \
    --to=kalle.pokki@iki.fi \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=vbordug@ru.mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox