diff options
author | Simon Glass <sjg@chromium.org> | 2019-12-20 18:10:36 -0700 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2020-01-02 16:25:25 +0100 |
commit | 775d33229ffdc94be9a74d73ef6fabe6ea0e7a6f (patch) | |
tree | c7b2db6704d8e12aebb98b2cce2cac359d84474f /drivers | |
parent | c6567319019df0e92db4a00d0dd35c3a8e9c2f7f (diff) | |
download | u-boot-775d33229ffdc94be9a74d73ef6fabe6ea0e7a6f.tar.gz u-boot-775d33229ffdc94be9a74d73ef6fabe6ea0e7a6f.tar.bz2 u-boot-775d33229ffdc94be9a74d73ef6fabe6ea0e7a6f.zip |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/vidconsole-uclass.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index c690eceeaa..75c7e25095 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -116,7 +116,6 @@ static void vidconsole_newline(struct udevice *dev) 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] = { { 0x00, 0x00, 0x00 }, /* black */ { 0xc0, 0x00, 0x00 }, /* red */ @@ -135,23 +134,22 @@ static const struct vid_rgb colors[VID_COLOR_COUNT] = { { 0x00, 0xff, 0xff }, /* bright cyan */ { 0xff, 0xff, 0xff }, /* white */ }; -#endif u32 vid_console_color(struct video_priv *priv, unsigned int idx) { switch (priv->bpix) { -#if CONFIG_IS_ENABLED(VIDEO_BPP16) case VIDEO_BPP16: - return ((colors[idx].r >> 3) << 11) | - ((colors[idx].g >> 2) << 5) | - ((colors[idx].b >> 3) << 0); -#endif -#if CONFIG_IS_ENABLED(VIDEO_BPP32) + if (CONFIG_IS_ENABLED(VIDEO_BPP16)) { + return ((colors[idx].r >> 3) << 11) | + ((colors[idx].g >> 2) << 5) | + ((colors[idx].b >> 3) << 0); + } case VIDEO_BPP32: - return (colors[idx].r << 16) | - (colors[idx].g << 8) | - (colors[idx].b << 0); -#endif + if (CONFIG_IS_ENABLED(VIDEO_BPP32)) { + return (colors[idx].r << 16) | + (colors[idx].g << 8) | + (colors[idx].b << 0); + } default: /* * For unknown bit arrangements just support |