提交 0c20aafe 编写于 作者: S Simon Glass 提交者: Anatolij Gustschin

video: Avoid using #ifdef in video-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 IS_ENABLED(), etc., instead.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 775d3322
...@@ -92,26 +92,24 @@ int video_clear(struct udevice *dev) ...@@ -92,26 +92,24 @@ int video_clear(struct udevice *dev)
struct video_priv *priv = dev_get_uclass_priv(dev); struct video_priv *priv = dev_get_uclass_priv(dev);
switch (priv->bpix) { switch (priv->bpix) {
#ifdef CONFIG_VIDEO_BPP16 case VIDEO_BPP16:
case VIDEO_BPP16: { if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
u16 *ppix = priv->fb; u16 *ppix = priv->fb;
u16 *end = priv->fb + priv->fb_size; u16 *end = priv->fb + priv->fb_size;
while (ppix < end) while (ppix < end)
*ppix++ = priv->colour_bg; *ppix++ = priv->colour_bg;
break; break;
} }
#endif case VIDEO_BPP32:
#ifdef CONFIG_VIDEO_BPP32 if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
case VIDEO_BPP32: { u32 *ppix = priv->fb;
u32 *ppix = priv->fb; u32 *end = priv->fb + priv->fb_size;
u32 *end = priv->fb + priv->fb_size;
while (ppix < end)
while (ppix < end) *ppix++ = priv->colour_bg;
*ppix++ = priv->colour_bg; break;
break; }
}
#endif
default: default:
memset(priv->fb, priv->colour_bg, priv->fb_size); memset(priv->fb, priv->colour_bg, priv->fb_size);
break; break;
...@@ -125,14 +123,14 @@ void video_set_default_colors(struct udevice *dev, bool invert) ...@@ -125,14 +123,14 @@ void video_set_default_colors(struct udevice *dev, bool invert)
struct video_priv *priv = dev_get_uclass_priv(dev); struct video_priv *priv = dev_get_uclass_priv(dev);
int fore, back; int fore, back;
#ifdef CONFIG_SYS_WHITE_ON_BLACK if (CONFIG_IS_ENABLED(SYS_WHITE_ON_BLACK)) {
/* White is used when switching to bold, use light gray here */ /* White is used when switching to bold, use light gray here */
fore = VID_LIGHT_GRAY; fore = VID_LIGHT_GRAY;
back = VID_BLACK; back = VID_BLACK;
#else } else {
fore = VID_BLACK; fore = VID_BLACK;
back = VID_WHITE; back = VID_WHITE;
#endif }
if (invert) { if (invert) {
int temp; int temp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册