[U-Boot] [PATCH 16/17] sunxi: video: Remove sunxi_display.enabled variable

Hans de Goede
2014-12-24T19:06:28Z

Having both a sunxi_display.enabled variable and
sunxi_display.monitor == sunxi_monitor_none duplicates state, use
sunxi_display.monitor = sunxi_monitor_none when ever we do not have a display.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/video/sunxi_display.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 624e5e0..a169d78 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -33,7 +33,6 @@ enum sunxi_monitor {

struct sunxi_display {
GraphicDevice graphic_device;
- bool enabled;
enum sunxi_monitor monitor;
unsigned int depth;
} sunxi_display;
@@ -828,6 +827,7 @@ void *video_hw_init(void)
case sunxi_monitor_hdmi:
#ifndef CONFIG_VIDEO_HDMI
printf("HDMI/DVI not supported on this board\n");
+ sunxi_display.monitor = sunxi_monitor_none;
return NULL;
#else
/* Always call hdp_detect, as it also enables clocks, etc. */
@@ -843,8 +843,10 @@ void *video_hw_init(void)

sunxi_hdmi_shutdown();

- if (lcd_mode[0] == 0)
+ if (lcd_mode[0] == 0) {
+ sunxi_display.monitor = sunxi_monitor_none;
return NULL; /* No LCD, bail */
+ }

/* Fall back / through to LCD */
sunxi_display.monitor = sunxi_monitor_lcd;
@@ -856,6 +858,7 @@ void *video_hw_init(void)
break;
}
printf("LCD not supported on this board\n");
+ sunxi_display.monitor = sunxi_monitor_none;
return NULL;
case sunxi_monitor_vga:
#ifdef CONFIG_VIDEO_VGA_VIA_LCD
@@ -863,6 +866,7 @@ void *video_hw_init(void)
break;
#else
printf("VGA not supported on this board\n");
+ sunxi_display.monitor = sunxi_monitor_none;
return NULL;
#endif
}
@@ -875,7 +879,6 @@ void *video_hw_init(void)
mode->yres, mon_desc[sunxi_display.monitor]);
}

- sunxi_display.enabled = true;
sunxi_engines_init();
sunxi_mode_set(mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE);

@@ -903,9 +906,6 @@ int sunxi_simplefb_setup(void *blob)
int offset, ret;
const char *pipeline = NULL;

- if (!sunxi_display.enabled)
- return 0;
-
switch (sunxi_display.monitor) {
case sunxi_monitor_none:
return 0;
--
2.1.0