linux-mips
[Top] [All Lists]

[PATCH] IP22 console font patch, testing needed.

To: linux-mips@linux-mips.org
Subject: [PATCH] IP22 console font patch, testing needed.
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 22 Aug 2007 17:48:40 +0100
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.14 (2007-02-12)
Could somebody please test this patch to sort out font handling for the
IP22 Newport console driver?  Thanks,

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/drivers/video/console/newport_con.c 
b/drivers/video/console/newport_con.c
index 7fa1afe..a2cb77b 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
+#include <linux/font.h>
 #include <linux/kd.h>
 #include <linux/selection.h>
 #include <linux/console.h>
@@ -33,7 +34,7 @@
 
 extern unsigned long sgi_gfxaddr;
 
-#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
+static const struct font_desc *default_font;
 
 /* borrowed from fbcon.c */
 #define REFCOUNT(fd)   (((int *)(fd))[-1])
@@ -300,6 +301,10 @@ static const char *newport_startup(void)
        if (!sgi_gfxaddr)
                return NULL;
 
+       default_font = find_font("VGA8x16");
+       if (!default_font)
+               return NULL;
+
        if (!npregs)
                npregs = (struct newport_regs *)/* ioremap cannot fail */
                        ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
@@ -313,7 +318,7 @@ static const char *newport_startup(void)
                goto out_unmap;
 
        for (i = 0; i < MAX_NR_CONSOLES; i++)
-               font_data[i] = FONT_DATA;
+               font_data[i] = (unsigned char *) default_font->data;
 
        newport_reset();
        newport_get_revisions();
@@ -522,7 +527,7 @@ static int newport_set_font(int unit, struct console_font 
*op)
 
        /* check if font is already used by other console */
        for (i = 0; i < MAX_NR_CONSOLES; i++) {
-               if (font_data[i] != FONT_DATA
+               if (font_data[i] != default_font->data
                    && FNTSIZE(font_data[i]) == size
                    && !memcmp(font_data[i], new_data, size)) {
                        kfree(new_data - FONT_EXTRA_WORDS * sizeof(int));
@@ -534,7 +539,7 @@ static int newport_set_font(int unit, struct console_font 
*op)
                }
        }
        /* old font is user font */
-       if (font_data[unit] != FONT_DATA) {
+       if (font_data[unit] != default_font->data) {
                if (--REFCOUNT(font_data[unit]) == 0)
                        kfree(font_data[unit] -
                              FONT_EXTRA_WORDS * sizeof(int));
@@ -547,11 +552,11 @@ static int newport_set_font(int unit, struct console_font 
*op)
 
 static int newport_set_def_font(int unit, struct console_font *op)
 {
-       if (font_data[unit] != FONT_DATA) {
+       if (font_data[unit] != default_font->data) {
                if (--REFCOUNT(font_data[unit]) == 0)
                        kfree(font_data[unit] -
                              FONT_EXTRA_WORDS * sizeof(int));
-               font_data[unit] = FONT_DATA;
+               font_data[unit] = (unsigned char *) default_font->data;
        }
 
        return 0;
@@ -740,7 +745,7 @@ static int __init newport_console_init(void)
 {
 
        if (!sgi_gfxaddr)
-               return NULL;
+               return 0;
 
        if (!npregs)
                npregs = (struct newport_regs *)/* ioremap cannot fail */

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] IP22 console font patch, testing needed., Ralf Baechle <=