summaryrefslogtreecommitdiff
path: root/drivers/video/console
diff options
context:
space:
mode:
authorSven Schnelle <svens@stackframe.org>2021-11-14 19:08:17 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-26 13:40:40 +0300
commitb8615eb8dcdf53e42538ef6999b9dbbae951c089 (patch)
tree1c43572e137e8cfaba21d65b4afd84dc10d72d22 /drivers/video/console
parent804a9d239ae9cbe88e861a7cd62319cc6ec7b136 (diff)
downloadlinux-b8615eb8dcdf53e42538ef6999b9dbbae951c089.tar.xz
parisc/sticon: fix reverse colors
commit bec05f33ebc1006899c6d3e59a00c58881fe7626 upstream. sticon_build_attr() checked the reverse argument and flipped background and foreground color, but returned the non-reverse value afterwards. Fix this and also add two local variables for foreground and background color to make the code easier to read. Signed-off-by: Sven Schnelle <svens@stackframe.org> Cc: <stable@vger.kernel.org> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/sticon.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 79c9bd8d3025..559a7305cada 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -291,13 +291,13 @@ static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos,
static u8 sticon_build_attr(struct vc_data *conp, u8 color, u8 intens,
u8 blink, u8 underline, u8 reverse, u8 italic)
{
- u8 attr = ((color & 0x70) >> 1) | ((color & 7));
+ u8 fg = color & 7;
+ u8 bg = (color & 0x70) >> 4;
- if (reverse) {
- color = ((color >> 3) & 0x7) | ((color & 0x7) << 3);
- }
-
- return attr;
+ if (reverse)
+ return (fg << 3) | bg;
+ else
+ return (bg << 3) | fg;
}
static void sticon_invert_region(struct vc_data *conp, u16 *p, int count)