Re: [PATCH] console - Add configurable support for console charset translation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Woodhouse
Date: Wednesday, June 4, 2008 - 6:55 am

On Wed, 2008-06-04 at 12:55 +0100, Alan Cox wrote:

Good point. I did think about that originally, but then just completely
forgot to process that hunk of the original patch altogether, which was
another way of avoiding the ifdefs :)

If I merge this incremental patch, does that address your objections?

(Note that I've changed the expression to evaluate (c) only once, just
because that's best practice in macro definitions. Wasn't really worth
doing it for (vc) though.)

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index de52f99..18b7fb0 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2208,11 +2208,7 @@ rescan_last_byte:
 			c = 0xfffd;
 		    tc = c;
 		} else {	/* no utf or alternate charset mode */
-#ifdef CONFIG_CONSOLE_TRANSLATIONS
-		    tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c];
-#else
-		    tc = c;
-#endif
+		    tc = vc_translate(vc, c);
 		}
 
 		param.c = tc;
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 81ed155..929ee80 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -72,6 +72,9 @@ int con_set_default_unimap(struct vc_data *vc);
 void con_free_unimap(struct vc_data *vc);
 void con_protect_unimap(struct vc_data *vc, int rdonly);
 int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
+
+#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
+					(vc)->vc_toggle_meta ? 0x80 : 0])
 #else
 #define con_set_trans_old(arg) (0)
 #define con_get_trans_old(arg) (-EINVAL)
@@ -83,6 +86,8 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
 #define con_copy_unimap(d, s) (0)
 #define con_get_unimap(vc, ct, uct, list) (-EINVAL)
 #define con_free_unimap(vc) do { ; } while (0)
+
+#define vc_translate(vc, c) (c)
 #endif
 
 /* vt.c */

-- 
dwmw2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] console - Add configurable support for console ..., David Woodhouse, (Wed Jun 4, 6:55 am)
mainlining min-configs..., Tim Bird, (Mon Jun 9, 6:37 pm)
Re: mainlining min-configs..., Ben Nizette, (Mon Jun 9, 8:14 pm)
Re: mainlining min-configs..., Paul Mundt, (Mon Jun 9, 9:16 pm)
Re: mainlining min-configs..., Adrian Bunk, (Tue Jun 10, 1:36 am)
Re: mainlining min-configs..., Tim Bird, (Tue Jun 10, 11:18 am)
Re: mainlining min-configs..., Adrian Bunk, (Tue Jun 10, 11:30 am)
Re: mainlining min-configs..., Sam Ravnborg, (Tue Jun 10, 11:51 am)
Re: mainlining min-configs..., Adrian Bunk, (Tue Jun 10, 12:05 pm)
Re: mainlining min-configs..., Rob Landley, (Tue Jun 10, 8:32 pm)
Re: mainlining min-configs..., Rob Landley, (Tue Jun 10, 8:48 pm)
Re: mainlining min-configs..., Rob Landley, (Tue Jun 10, 10:09 pm)
Re: mainlining min-configs..., Rob Landley, (Tue Jun 10, 10:17 pm)
Re: mainlining min-configs..., Rob Landley, (Tue Jun 10, 10:51 pm)
Re: mainlining min-configs..., Sam Ravnborg, (Tue Jun 10, 11:39 pm)
Re: mainlining min-configs..., Christian MICHON, (Wed Jun 11, 1:59 am)
Re: mainlining min-configs..., Tim Bird, (Wed Jun 11, 12:09 pm)
Re: mainlining min-configs..., Sam Ravnborg, (Wed Jun 11, 12:22 pm)
Re: mainlining min-configs..., Adrian Bunk, (Wed Jun 11, 12:36 pm)
Re: mainlining min-configs..., Tim Bird, (Wed Jun 11, 12:46 pm)
Re: mainlining min-configs..., Sam Ravnborg, (Wed Jun 11, 12:48 pm)
Re: mainlining min-configs..., Rob Landley, (Wed Jun 11, 5:01 pm)
Re: mainlining min-configs..., Rob Landley, (Wed Jun 11, 6:42 pm)