summaryrefslogtreecommitdiff
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-06-07 13:49:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-10 14:37:01 +0300
commit2097dc2273a5b5254d0fad79afdedd223035b2d5 (patch)
tree1d252c146b5d4354633f6c193cd463b45d669030 /drivers/tty/vt
parentdb8f597a47127d0554f9c059a6da35f3ff34e773 (diff)
downloadlinux-2097dc2273a5b5254d0fad79afdedd223035b2d5.tar.xz
tty/vt: consolemap: decrypt inverse_translate()
Fix invalid indentation and demystify the code by removing superfluous "else"s. The "else"s are unneeded as they always follow an "if"-true branch containing a "return". The code is now way more readable. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220607104946.18710-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/consolemap.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 15aa10ff87ad..fb61158f4dc6 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -285,25 +285,26 @@ u16 inverse_translate(const struct vc_data *conp, int glyph, int use_unicode)
{
struct uni_pagedict *p;
int m;
+
if (glyph < 0 || glyph >= MAX_GLYPH)
return 0;
- else {
- p = *conp->vc_uni_pagedir_loc;
- if (!p)
+
+ p = *conp->vc_uni_pagedir_loc;
+ if (!p)
+ return glyph;
+
+ if (use_unicode) {
+ if (!p->inverse_trans_unicode)
return glyph;
- else if (use_unicode) {
- if (!p->inverse_trans_unicode)
- return glyph;
- else
- return p->inverse_trans_unicode[glyph];
- } else {
- m = inv_translate[conp->vc_num];
- if (!p->inverse_translations[m])
- return glyph;
- else
- return p->inverse_translations[m][glyph];
- }
+
+ return p->inverse_trans_unicode[glyph];
}
+
+ m = inv_translate[conp->vc_num];
+ if (!p->inverse_translations[m])
+ return glyph;
+
+ return p->inverse_translations[m][glyph];
}
EXPORT_SYMBOL_GPL(inverse_translate);