[U-Boot] [PATCH] dm: video: fix abuse of enum
Lothar Waßmann
LW at KARO-electronics.de
Tue Jun 20 10:25:29 UTC 2017
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 at 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
More information about the U-Boot
mailing list