Commit 6e4e8d74 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

tty/vt: consolemap: make con_set_unimap() more readable

The indentation was completely broken in con_set_unimap(). Reorder the
code using 'if (!cond) continue;'s so that the code makes sense. Not
that it is perfect now, but it can be followed at least. More cleanup to
come. And remove all those useless whitespaces at the EOLs too.
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-13-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent acf90b4d
......@@ -580,23 +580,21 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
/* Save original vc_unipagdir_loc in case we allocate a new one */
p = *vc->vc_uni_pagedir_loc;
if (!p) {
err = -EINVAL;
goto out_unlock;
}
if (p->refcount > 1) {
int j, k;
u16 **p1, *p2, l;
err1 = con_do_clear_unimap(vc);
if (err1) {
err = err1;
goto out_unlock;
}
/*
* Since refcount was > 1, con_clear_unimap() allocated a
* a new uni_pagedict for this vc. Re: p != q
......@@ -611,13 +609,26 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
*/
l = 0; /* unicode value */
for (i = 0; i < UNI_DIRS; i++) {
p1 = p->uni_pgdir[i];
if (p1)
p1 = p->uni_pgdir[i];
if (!p1) {
/* Account for empty table */
l += UNI_DIR_ROWS * UNI_ROW_GLYPHS;
continue;
}
for (j = 0; j < UNI_DIR_ROWS; j++) {
p2 = p1[j];
if (p2) {
for (k = 0; k < UNI_ROW_GLYPHS; k++, l++)
if (p2[k] != 0xffff) {
p2 = p1[j];
if (!p2) {
/*
* Account for row of 64 empty entries
*/
l += UNI_ROW_GLYPHS;
continue;
}
for (k = 0; k < UNI_ROW_GLYPHS; k++, l++) {
if (p2[k] == 0xffff)
continue;
/*
* Found one, copy entry for unicode
* l with fontpos value p2[k].
......@@ -632,15 +643,8 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
goto out_unlock;
}
}
} else {
/* Account for row of 64 empty entries */
l += UNI_ROW_GLYPHS;
}
}
else
/* Account for empty table */
l += UNI_DIR_ROWS * UNI_ROW_GLYPHS;
}
/*
* Finished copying font table, set vc_uni_pagedir to new table
......@@ -658,7 +662,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
if (err1)
err = err1;
}
/*
* Merge with fontmaps of any other virtual consoles.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment