public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] video: add guards around 16bpp/32bbp code
@ 2019-12-05 17:15 Anatolij Gustschin
  2019-12-05 17:15 ` [PATCH 2/2] video: make BPP and ANSI configs optional Anatolij Gustschin
  2019-12-10 10:25 ` [PATCH 1/2] video: add guards around 16bpp/32bbp code Anatolij Gustschin
  0 siblings, 2 replies; 8+ messages in thread
From: Anatolij Gustschin @ 2019-12-05 17:15 UTC (permalink / raw)
  To: u-boot

Many boards use only single depth configuration, for such boards
there is some unused code in video and console uclass routines.
Add guards to avoid dead code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/video/vidconsole-uclass.c | 6 ++++++
 drivers/video/video-uclass.c      | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index af88588904..c690eceeaa 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -116,6 +116,7 @@ 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 */
@@ -134,18 +135,23 @@ 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)
 	case VIDEO_BPP32:
 		return (colors[idx].r << 16) |
 		       (colors[idx].g <<  8) |
 		       (colors[idx].b <<  0);
+#endif
 	default:
 		/*
 		 * For unknown bit arrangements just support
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f660c5205e..5ea7568fa4 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -92,6 +92,7 @@ int video_clear(struct udevice *dev)
 	struct video_priv *priv = dev_get_uclass_priv(dev);
 
 	switch (priv->bpix) {
+#ifdef CONFIG_VIDEO_BPP16
 	case VIDEO_BPP16: {
 		u16 *ppix = priv->fb;
 		u16 *end = priv->fb + priv->fb_size;
@@ -100,6 +101,8 @@ int video_clear(struct udevice *dev)
 			*ppix++ = priv->colour_bg;
 		break;
 	}
+#endif
+#ifdef CONFIG_VIDEO_BPP32
 	case VIDEO_BPP32: {
 		u32 *ppix = priv->fb;
 		u32 *end = priv->fb + priv->fb_size;
@@ -108,6 +111,7 @@ int video_clear(struct udevice *dev)
 			*ppix++ = priv->colour_bg;
 		break;
 	}
+#endif
 	default:
 		memset(priv->fb, priv->colour_bg, priv->fb_size);
 		break;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-10 10:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-05 17:15 [PATCH 1/2] video: add guards around 16bpp/32bbp code Anatolij Gustschin
2019-12-05 17:15 ` [PATCH 2/2] video: make BPP and ANSI configs optional Anatolij Gustschin
2019-12-05 18:32   ` Anatolij Gustschin
2019-12-09 14:46     ` Steffen Dirkwinkel
2019-12-06 13:44   ` Eugen.Hristev at microchip.com
2019-12-06 14:21   ` Patrice CHOTARD
2019-12-10 10:27   ` Anatolij Gustschin
2019-12-10 10:25 ` [PATCH 1/2] video: add guards around 16bpp/32bbp code Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox