public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: video: fix abuse of enum
@ 2017-06-20 10:25 Lothar Waßmann
  2017-06-20 18:26 ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Lothar Waßmann @ 2017-06-20 10:25 UTC (permalink / raw)
  To: u-boot

LCD_MAX_WIDTH, LCD_MAX_HEIGHT and LCD_MAX_LSBPP are not alternative
values for one specific variable, but unrelated entities with distinct
purposes. There is no use defining them as values of an 'enum'.

The 'enum' construct would fail miserably for an LCD controller that
has a square max. frame size (e.g. 4096x4096).

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/video/atmel_hlcdfb.c     |  8 +++-----
 drivers/video/atmel_lcdfb.c      | 10 ++++------
 drivers/video/sandbox_sdl.c      |  8 +++-----
 drivers/video/tegra.c            | 12 +++++-------
 drivers/video/tegra124/display.c | 11 +++++------
 5 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index 59b9c45..7426abb 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -244,11 +244,9 @@ void lcd_ctrl_init(void *lcdbase)
 
 #else
 
-enum {
-	LCD_MAX_WIDTH		= 1024,
-	LCD_MAX_HEIGHT		= 768,
-	LCD_MAX_LOG2_BPP	= VIDEO_BPP16,
-};
+#define LCD_MAX_WIDTH		1024
+#define LCD_MAX_HEIGHT		768
+#define LCD_MAX_LOG2_BPP	VIDEO_BPP16
 
 struct atmel_hlcdc_priv {
 	struct atmel_hlcd_regs *regs;
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index ed2bd30..c4f6251 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -21,12 +21,10 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_DM_VIDEO
-enum {
-	/* Maximum LCD size we support */
-	LCD_MAX_WIDTH		= 1366,
-	LCD_MAX_HEIGHT		= 768,
-	LCD_MAX_LOG2_BPP	= VIDEO_BPP16,
-};
+/* Maximum LCD size we support */
+#define LCD_MAX_WIDTH		1366
+#define LCD_MAX_HEIGHT		768
+#define LCD_MAX_LOG2_BPP	VIDEO_BPP16
 #endif
 
 struct atmel_fb_priv {
diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c
index 18afe2f..e1b6a85 100644
--- a/drivers/video/sandbox_sdl.c
+++ b/drivers/video/sandbox_sdl.c
@@ -14,11 +14,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-enum {
-	/* Default LCD size we support */
-	LCD_MAX_WIDTH		= 1366,
-	LCD_MAX_HEIGHT		= 768,
-};
+/* Default LCD size we support */
+#define LCD_MAX_WIDTH		1366
+#define LCD_MAX_HEIGHT		768
 
 static int sandbox_sdl_probe(struct udevice *dev)
 {
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
index 0ba3f2c..87db07a 100644
--- a/drivers/video/tegra.c
+++ b/drivers/video/tegra.c
@@ -1,4 +1,4 @@
-/*
+s/*
  * Copyright (c) 2011 The Chromium OS Authors.
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -34,12 +34,10 @@ struct tegra_lcd_priv {
 	unsigned pixel_clock;		/* Pixel clock in Hz */
 };
 
-enum {
-	/* Maximum LCD size we support */
-	LCD_MAX_WIDTH		= 1366,
-	LCD_MAX_HEIGHT		= 768,
-	LCD_MAX_LOG2_BPP	= VIDEO_BPP16,
-};
+/* Maximum LCD size we support */
+#define LCD_MAX_WIDTH		1366
+#define LCD_MAX_HEIGHT		768
+#define LCD_MAX_LOG2_BPP	VIDEO_BPP16
 
 static void update_window(struct dc_ctlr *dc, struct disp_ctl_win *win)
 {
diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index bbbca13..1c641a4 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -420,12 +420,11 @@ static int display_init(struct udevice *dev, void *lcdbase,
 	return 0;
 }
 
-enum {
-	/* Maximum LCD size we support */
-	LCD_MAX_WIDTH		= 1920,
-	LCD_MAX_HEIGHT		= 1200,
-	LCD_MAX_LOG2_BPP	= 4,		/* 2^4 = 16 bpp */
-};
+
+/* Maximum LCD size we support */
+#define LCD_MAX_WIDTH		1920
+#define LCD_MAX_HEIGHT		1200
+#define LCD_MAX_LOG2_BPP	VIDEO_BPP16
 
 static int tegra124_lcd_init(struct udevice *dev, void *lcdbase,
 			     enum video_log2_bpp l2bpp)
-- 
2.1.4

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

end of thread, other threads:[~2017-07-14 13:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-20 10:25 [U-Boot] [PATCH] dm: video: fix abuse of enum Lothar Waßmann
2017-06-20 18:26 ` Simon Glass
2017-06-21  7:59   ` Lothar Waßmann
2017-06-23  6:30     ` Lothar Waßmann
2017-07-06  4:49       ` Simon Glass
2017-07-06  7:50         ` Lothar Waßmann
2017-07-06 12:22           ` Marcel Ziswiler
2017-07-07  6:41             ` Lothar Waßmann
2017-07-14 13:47               ` Simon Glass

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