Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: linux-mips@linux-mips.org
Subject: [PATCH] IP22 console font patch, testing needed.
Date: Wed, 22 Aug 2007 17:48:40 +0100	[thread overview]
Message-ID: <20070822164840.GA1648@linux-mips.org> (raw)

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 */

                 reply	other threads:[~2007-08-22 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070822164840.GA1648@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox