Skip to contentSkip to conversation

video: cfb_console: fix definition and usage of CURSOR_xxx macros

PATCH New Timur Tabi 3 participants 3 messages Aug 27, 2010 – Aug 30, 2010 Framebuffer layer

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 video: cfb_console: fix definition and usage of CURSOR_xxx macros

The CURSOR_ON, CURSOR_OFF, and CURSOR_SET macros are defined incorrectly. If cursor support is disabled, then these macros are defined to nothing, but then they are used like this:

	if (console_col < CONSOLE_COLS)
		CURSOR_OFF
	console_row++;

which was compiled like this:

	if (console_col < CONSOLE_COLS)
		console_row++;

This is obviously not what was intended.

---

This patch depends on

video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB

 drivers/video/cfb_console.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
drivers/video/cfb_console.c +14 -10
index 1d52819..52e7fb4 100644
@@ -230,8 +230,8 @@ CONFIG_VIDEO_HW_CURSOR:	     - Uses the hardware cursor capability of the
 #error	only one of CONFIG_CONSOLE_CURSOR,CONFIG_VIDEO_SW_CURSOR,CONFIG_VIDEO_HW_CURSOR can be defined
 #endif
 void	console_cursor (int state);
-#define CURSOR_ON  console_cursor(1);
-#define CURSOR_OFF console_cursor(0);
+#define CURSOR_ON  console_cursor(1)
+#define CURSOR_OFF console_cursor(0)
 #define CURSOR_SET
 #ifndef CONFIG_I8042_KBD
 #warning Cursor drawing on/off needs timer function s.a. drivers/input/i8042.c
@@ -248,8 +248,8 @@ void	console_cursor (int state);
 #endif
 #define CURSOR_ON
 #define CURSOR_OFF video_putchar(console_col * VIDEO_FONT_WIDTH,\
-				 console_row * VIDEO_FONT_HEIGHT, ' ');
-#define CURSOR_SET video_set_cursor();
+				 console_row * VIDEO_FONT_HEIGHT, ' ')
+#define CURSOR_SET video_set_cursor()
 #endif /* CONFIG_VIDEO_SW_CURSOR */
 
 
@@ -260,7 +260,7 @@ void	console_cursor (int state);
 #define CURSOR_ON
 #define CURSOR_OFF
 #define CURSOR_SET video_set_hw_cursor(console_col * VIDEO_FONT_WIDTH, \
-		  (console_row * VIDEO_FONT_HEIGHT) + video_logo_height);
+		  (console_row * VIDEO_FONT_HEIGHT) + video_logo_height)
 #endif	/* CONFIG_VIDEO_HW_CURSOR */
 
 #ifdef	CONFIG_VIDEO_LOGO
@@ -651,7 +651,8 @@ static void console_scrollup (void)
 
 static void console_back (void)
 {
-	CURSOR_OFF console_col--;
+	CURSOR_OFF;
+	console_col--;
 
 	if (console_col < 0) {
 		console_col = CONSOLE_COLS - 1;
@@ -674,7 +675,7 @@ static void console_newline (void)
 	   is >= CONSOLE_COLS
 	 */
 	if (console_col < CONSOLE_COLS)
-		CURSOR_OFF
+		CURSOR_OFF;
 	console_row++;
 	console_col = 0;
 
@@ -690,7 +691,8 @@ static void console_newline (void)
 
 static void console_cr (void)
 {
-	CURSOR_OFF console_col = 0;
+	CURSOR_OFF;
+	console_col = 0;
 }
 
 /*****************************************************************************/
@@ -711,7 +713,8 @@ void video_putc (const char c)
 		break;
 
 	case 9:		/* tab 8 */
-		CURSOR_OFF console_col |= 0x0008;
+		CURSOR_OFF;
+		console_col |= 0x0008;
 		console_col &= ~0x0007;
 
 		if (console_col >= CONSOLE_COLS)
@@ -734,7 +737,8 @@ void video_putc (const char c)
 			nl = 0;
 		}
 	}
-CURSOR_SET}
+	CURSOR_SET;
+}
 
 
 /*****************************************************************************/
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 1/1 video: cfb_console: fix definition and usage of CURSOR_xxx macros

Hi Timur,

Quoted 8 lines

The CURSOR_ON, CURSOR_OFF, and CURSOR_SET macros are defined incorrectly. If cursor support is disabled, then these macros are defined to nothing, but then they are used like this:

	if (console_col < CONSOLE_COLS)
		CURSOR_OFF
	console_row++;
Quoted 8 lines

which was compiled like this:

	if (console_col < CONSOLE_COLS)
		console_row++;

This is obviously not what was intended.

Patch looks good, thanks!

Quoted 8 lines

---

This patch depends on

video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB

 drivers/video/cfb_console.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
Signature · 7 lines
Man against god... God against Man... Man against nature... Nature against
man...   God against nature...   Nature against god...  a very, very funny
religion.             -- Zen Master D.T. Suzuki commenting on Christianity
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#2 lore raw

PATCH 1/1 video: cfb_console: fix definition and usage of CURSOR_xxx macros

In reply to Timur Tabi
Quoted 16 lines · On Fri, 27 Aug 2010 15:45:47 -0500 Timur Tabi <[email protected]> wrote:

The CURSOR_ON, CURSOR_OFF, and CURSOR_SET macros are defined incorrectly. If cursor support is disabled, then these macros are defined to nothing, but then they are used like this:

	if (console_col < CONSOLE_COLS)
		CURSOR_OFF
	console_row++;

which was compiled like this:

	if (console_col < CONSOLE_COLS)
		console_row++;

This is obviously not what was intended.

Quoted 8 lines

---

This patch depends on

video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB

 drivers/video/cfb_console.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

Applied to u-boot-video/master. Thanks!

Best regards,
Anatolij