aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/console
diff options
context:
space:
mode:
authorJiri Slaby2020-06-15 09:48:35 +0200
committerGreg Kroah-Hartman2020-06-24 17:08:31 +0200
commit77bc14f273c2dfecbf87f41fdc00345d99597e13 (patch)
treee343f0d17484052cc52aa66b2ea5c11f9b6d4ff2 /drivers/video/console
parentb84ae3dc70fedf4bdee2dbfa487fd23b606fbb82 (diff)
vc: switch state to bool
The code currently uses bitfields to store true-false values. Switch all of that to bools. Apart from the cleanup, it saves 20B of code as many shifts, ANDs, and ORs became simple movzb's. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20200615074910.19267-3-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/mdacon.c11
-rw-r--r--drivers/video/console/sticon.c3
-rw-r--r--drivers/video/console/vgacon.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index e3da664df16c..00cb6245fbef 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -396,7 +396,8 @@ static inline u16 mda_convert_attr(u16 ch)
static u8 mdacon_build_attr(struct vc_data *c, u8 color,
enum vc_intensity intensity,
- u8 blink, u8 underline, u8 reverse, u8 italic)
+ bool blink, bool underline, bool reverse,
+ bool italic)
{
/* The attribute is just a bit vector:
*
@@ -407,10 +408,10 @@ static u8 mdacon_build_attr(struct vc_data *c, u8 color,
*/
return (intensity & VCI_MASK) |
- ((underline & 1) << 2) |
- ((reverse & 1) << 3) |
- (!!italic << 4) |
- ((blink & 1) << 7);
+ (underline << 2) |
+ (reverse << 3) |
+ (italic << 4) |
+ (blink << 7);
}
static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index a847067abbe5..bbcdfd312c36 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -290,7 +290,8 @@ static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos,
static u8 sticon_build_attr(struct vc_data *conp, u8 color,
enum vc_intensity intens,
- u8 blink, u8 underline, u8 reverse, u8 italic)
+ bool blink, bool underline, bool reverse,
+ bool italic)
{
u8 attr = ((color & 0x70) >> 1) | ((color & 7));
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d0b26e2318d3..c1c4ce28ac5e 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -631,7 +631,8 @@ static void vgacon_deinit(struct vc_data *c)
static u8 vgacon_build_attr(struct vc_data *c, u8 color,
enum vc_intensity intensity,
- u8 blink, u8 underline, u8 reverse, u8 italic)
+ bool blink, bool underline, bool reverse,
+ bool italic)
{
u8 attr = color;