[PATCH] newport_con: Fix resource acquisition

DORMANTno replies

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-06-25 12:04:48
Subsystem: console subsystem, framebuffer layer, the rest · Maintainers: Greg Kroah-Hartman, Helge Deller, Linus Torvalds

newport_con can be compiled statically and assigned directly to conswitchp, or
it can be compiled as a module, in which case, it goes through the
take_over_console() pathway.

In the former, resource acquisition is done in newport_startup() and in the
latter, the resources are acquired in newport_console_init().

Fix so resources are properly acquired whatever pathway it goes through.

Signed-off-by: Antonino Daplas <redacted>
---

Andrew,

I reexamined the changes I made to the various console drivers to make
them work with dynamic VT binding. I discovered that newport_con can
be loaded in 2 ways, directly or via take_over_console().

The changes I made in vt-binding-make-newport_con-support-binding.patch
will work only if newport_con is compiled as a module.

You may choose to fold this with the above patch.

Tony

 drivers/video/console/newport_con.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index cc121dc..0304131 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -298,6 +298,12 @@ static const char *newport_startup(void)
 {
 	int i;
 
+	if (!sgi_gfxaddr)
+		return NULL;
+
+	if (!npregs)
+		npregs = (struct newport_regs *)/* ioremap cannot fail */
+			ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
 	npregs->cset.config = NPORT_CFG_GD0;
 
 	if (newport_wait(npregs))
@@ -730,19 +736,21 @@ const struct consw newport_con = {
 	.con_save_screen  = DUMMY
 };
 
+#ifdef MODULE
 static int __init newport_console_init(void)
 {
 
 	if (!sgi_gfxaddr)
 		return NULL;
-	npregs = (struct newport_regs *)	/* ioremap cannot fail */
-		 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
+
+	if (!npregs)
+		npregs = (struct newport_regs *)/* ioremap cannot fail */
+			ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
 
 	return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
 }
 module_init(newport_console_init);
 
-#ifdef MODULE
 static void __exit newport_console_exit(void)
 {
 	give_up_console(&newport_con);

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help