1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-04 10:12:14 +02:00

video: Avoid using #ifdef in vidconsole-uclass.c

This code does not really need to use #ifdef. We can use if() instead and
gain build coverage without impacting code size.

Change the #ifdefs to use CONFIG_IS_ENABLED() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2019-12-20 18:10:36 -07:00
committed by Anatolij Gustschin
parent c656731901
commit 775d33229f

View File

@@ -116,7 +116,6 @@ static void vidconsole_newline(struct udevice *dev)
video_sync(dev->parent, false); video_sync(dev->parent, false);
} }
#if CONFIG_IS_ENABLED(VIDEO_BPP16) || CONFIG_IS_ENABLED(VIDEO_BPP32)
static const struct vid_rgb colors[VID_COLOR_COUNT] = { static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0x00, 0x00 }, /* black */ { 0x00, 0x00, 0x00 }, /* black */
{ 0xc0, 0x00, 0x00 }, /* red */ { 0xc0, 0x00, 0x00 }, /* red */
@@ -135,23 +134,22 @@ static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0xff, 0xff }, /* bright cyan */ { 0x00, 0xff, 0xff }, /* bright cyan */
{ 0xff, 0xff, 0xff }, /* white */ { 0xff, 0xff, 0xff }, /* white */
}; };
#endif
u32 vid_console_color(struct video_priv *priv, unsigned int idx) u32 vid_console_color(struct video_priv *priv, unsigned int idx)
{ {
switch (priv->bpix) { switch (priv->bpix) {
#if CONFIG_IS_ENABLED(VIDEO_BPP16)
case VIDEO_BPP16: case VIDEO_BPP16:
return ((colors[idx].r >> 3) << 11) | if (CONFIG_IS_ENABLED(VIDEO_BPP16)) {
((colors[idx].g >> 2) << 5) | return ((colors[idx].r >> 3) << 11) |
((colors[idx].b >> 3) << 0); ((colors[idx].g >> 2) << 5) |
#endif ((colors[idx].b >> 3) << 0);
#if CONFIG_IS_ENABLED(VIDEO_BPP32) }
case VIDEO_BPP32: case VIDEO_BPP32:
return (colors[idx].r << 16) | if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
(colors[idx].g << 8) | return (colors[idx].r << 16) |
(colors[idx].b << 0); (colors[idx].g << 8) |
#endif (colors[idx].b << 0);
}
default: default:
/* /*
* For unknown bit arrangements just support * For unknown bit arrangements just support