aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-06-26 03:27:15 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:34 -0400
commite86bb8acc0fdca82d22d12d46ef5482ecc408b26 (patch)
treee9cfb71e6199377fd8c23f16908e6adbc3f6d48d /drivers/video
parentac08dae816d3ea5160bb3e8420e87c03bf42224b (diff)
[PATCH] VT binding: Make newport_con support binding
- move register ioremap from newport_startup() to newport_console_init() - fonts are freed multiple times, do it only once Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/newport_con.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index e99fe30e568c..03041311711b 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -51,6 +51,7 @@ static int topscan;
51static int xcurs_correction = 29; 51static int xcurs_correction = 29;
52static int newport_xsize; 52static int newport_xsize;
53static int newport_ysize; 53static int newport_ysize;
54static int newport_has_init;
54 55
55static int newport_set_def_font(int unit, struct console_font *op); 56static int newport_set_def_font(int unit, struct console_font *op);
56 57
@@ -283,6 +284,15 @@ static void newport_get_revisions(void)
283 xcurs_correction = 21; 284 xcurs_correction = 21;
284} 285}
285 286
287static void newport_exit(void)
288{
289 int i;
290
291 /* free memory used by user font */
292 for (i = 0; i < MAX_NR_CONSOLES; i++)
293 newport_set_def_font(i, NULL);
294}
295
286/* Can't be __init, take_over_console may call it later */ 296/* Can't be __init, take_over_console may call it later */
287static const char *newport_startup(void) 297static const char *newport_startup(void)
288{ 298{
@@ -290,8 +300,10 @@ static const char *newport_startup(void)
290 300
291 if (!sgi_gfxaddr) 301 if (!sgi_gfxaddr)
292 return NULL; 302 return NULL;
293 npregs = (struct newport_regs *) /* ioremap cannot fail */ 303
294 ioremap(sgi_gfxaddr, sizeof(struct newport_regs)); 304 if (!npregs)
305 npregs = (struct newport_regs *)/* ioremap cannot fail */
306 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
295 npregs->cset.config = NPORT_CFG_GD0; 307 npregs->cset.config = NPORT_CFG_GD0;
296 308
297 if (newport_wait(npregs)) 309 if (newport_wait(npregs))
@@ -307,11 +319,11 @@ static const char *newport_startup(void)
307 newport_reset(); 319 newport_reset();
308 newport_get_revisions(); 320 newport_get_revisions();
309 newport_get_screensize(); 321 newport_get_screensize();
322 newport_has_init = 1;
310 323
311 return "SGI Newport"; 324 return "SGI Newport";
312 325
313out_unmap: 326out_unmap:
314 iounmap((void *)npregs);
315 return NULL; 327 return NULL;
316} 328}
317 329
@@ -324,11 +336,10 @@ static void newport_init(struct vc_data *vc, int init)
324 336
325static void newport_deinit(struct vc_data *c) 337static void newport_deinit(struct vc_data *c)
326{ 338{
327 int i; 339 if (!con_is_bound(&newport_con) && newport_has_init) {
328 340 newport_exit();
329 /* free memory used by user font */ 341 newport_has_init = 0;
330 for (i = 0; i < MAX_NR_CONSOLES; i++) 342 }
331 newport_set_def_font(i, NULL);
332} 343}
333 344
334static void newport_clear(struct vc_data *vc, int sy, int sx, int height, 345static void newport_clear(struct vc_data *vc, int sy, int sx, int height,
@@ -728,16 +739,23 @@ const struct consw newport_con = {
728#ifdef MODULE 739#ifdef MODULE
729static int __init newport_console_init(void) 740static int __init newport_console_init(void)
730{ 741{
742
743 if (!sgi_gfxaddr)
744 return NULL;
745
746 if (!npregs)
747 npregs = (struct newport_regs *)/* ioremap cannot fail */
748 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
749
731 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); 750 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
732} 751}
752module_init(newport_console_init);
733 753
734static void __exit newport_console_exit(void) 754static void __exit newport_console_exit(void)
735{ 755{
736 give_up_console(&newport_con); 756 give_up_console(&newport_con);
737 iounmap((void *)npregs); 757 iounmap((void *)npregs);
738} 758}
739
740module_init(newport_console_init);
741module_exit(newport_console_exit); 759module_exit(newport_console_exit);
742#endif 760#endif
743 761