patch-2.4.22 linux-2.4.22/drivers/video/newport_con.c

Next file: linux-2.4.22/drivers/video/pmag-ba-fb.c
Previous file: linux-2.4.22/drivers/video/maxinefb.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/video/newport_con.c linux-2.4.22/drivers/video/newport_con.c
@@ -48,7 +48,7 @@
 
 static unsigned char *font_data[MAX_NR_CONSOLES];
 
-extern struct newport_regs *npregs;
+static struct newport_regs *npregs;
 
 static int logo_active;
 static int topscan;
@@ -56,6 +56,8 @@
 static int newport_xsize;
 static int newport_ysize;
 
+static int newport_set_def_font(int unit, struct console_font_op *op);
+
 #define BMASK(c) (c << 24)
 
 #define RENDER(regs, cp) do { \
@@ -282,27 +284,22 @@
 		xcurs_correction = 21;
 }
 
-#ifdef MODULE
+/* Can't be __init, take_over_console may call it later */
 static const char *newport_startup(void)
-#else
-static const char *__init newport_startup(void)
-#endif
 {
 	int i;
-	struct newport_regs *p;
 
 	if (!sgi_gfxaddr)
 		return NULL;
 	npregs = (struct newport_regs *) (KSEG1 + sgi_gfxaddr);
-	p = npregs;
-	p->cset.config = NPORT_CFG_GD0;
+	npregs->cset.config = NPORT_CFG_GD0;
 
 	if (newport_wait()) {
 		return NULL;
 	}
 
-	p->set.xstarti = TESTVAL;
-	if (p->set._xstart.word != XSTI_TO_FXSTART(TESTVAL))
+	npregs->set.xstarti = TESTVAL;
+	if (npregs->set._xstart.word != XSTI_TO_FXSTART(TESTVAL))
 		return NULL;
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
@@ -312,8 +309,6 @@
 	newport_get_revisions();
 	newport_get_screensize();
 
-	/* gfx_init (display_desc); */
-
 	return "SGI Newport";
 }
 
@@ -324,6 +319,15 @@
 	vc->vc_can_do_color = 1;
 }
 
+static void newport_deinit(struct vc_data *c)
+{
+	int i;
+
+	/* free memory used by user font */
+	for (i = 0; i < MAX_NR_CONSOLES; i++)
+		newport_set_def_font(i, NULL);
+}
+
 static void newport_clear(struct vc_data *vc, int sy, int sx, int height,
 			  int width)
 {
@@ -704,7 +708,7 @@
 const struct consw newport_con = {
     con_startup:	newport_startup,
     con_init:		newport_init,
-    con_deinit:		DUMMY,
+    con_deinit:		newport_deinit,
     con_clear:		newport_clear,
     con_putc:		newport_putc,
     con_putcs:		newport_putcs,
@@ -721,28 +725,20 @@
 };
 
 #ifdef MODULE
-MODULE_LICENSE("GPL");
-
-int init_module(void)
+static int __init newport_console_init(void)
 {
-	if (!newport_startup())
-		printk("Error loading SGI Newport Console driver\n");
-	else
-		printk("Loading SGI Newport Console Driver\n");
 	take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
 
 	return 0;
 }
 
-int cleanup_module(void)
+static void __exit newport_console_exit(void)
 {
-	int i;
-
-	printk("Unloading SGI Newport Console Driver\n");
-	/* free memory used by user font */
-	for (i = 0; i < MAX_NR_CONSOLES; i++)
-		newport_set_def_font(i, NULL);
-
-	return 0;
+	give_up_console(&newport_con);
 }
+
+module_init(newport_console_init);
+module_exit(newport_console_exit);
 #endif
+
+MODULE_LICENSE("GPL");

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)