Skip to contentSkip to conversation

newport_con: Fix resource acquisition

PATCH New Antonino A. Daplas 1 participant 1 message Jun 25, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 newport_con: Fix resource acquisition

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.

---

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(-)
drivers/video/console/newport_con.c +11 -3
index cc121dc..0304131 100644
@@ -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