Commit 6561863678822847be92c3bd06ae1d64acca4f6a

Authored by Timur Tabi
Committed by Anatolij Gustschin
1 parent a12555c02d

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.

Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Detlev Zundel <dzu@denx.de>

Showing 1 changed file with 14 additions and 10 deletions Side-by-side Diff

drivers/video/cfb_console.c
... ... @@ -230,8 +230,8 @@
230 230 #error only one of CONFIG_CONSOLE_CURSOR,CONFIG_VIDEO_SW_CURSOR,CONFIG_VIDEO_HW_CURSOR can be defined
231 231 #endif
232 232 void console_cursor (int state);
233   -#define CURSOR_ON console_cursor(1);
234   -#define CURSOR_OFF console_cursor(0);
  233 +#define CURSOR_ON console_cursor(1)
  234 +#define CURSOR_OFF console_cursor(0)
235 235 #define CURSOR_SET
236 236 #ifndef CONFIG_I8042_KBD
237 237 #warning Cursor drawing on/off needs timer function s.a. drivers/input/i8042.c
... ... @@ -248,8 +248,8 @@
248 248 #endif
249 249 #define CURSOR_ON
250 250 #define CURSOR_OFF video_putchar(console_col * VIDEO_FONT_WIDTH,\
251   - console_row * VIDEO_FONT_HEIGHT, ' ');
252   -#define CURSOR_SET video_set_cursor();
  251 + console_row * VIDEO_FONT_HEIGHT, ' ')
  252 +#define CURSOR_SET video_set_cursor()
253 253 #endif /* CONFIG_VIDEO_SW_CURSOR */
254 254  
255 255  
... ... @@ -260,7 +260,7 @@
260 260 #define CURSOR_ON
261 261 #define CURSOR_OFF
262 262 #define CURSOR_SET video_set_hw_cursor(console_col * VIDEO_FONT_WIDTH, \
263   - (console_row * VIDEO_FONT_HEIGHT) + video_logo_height);
  263 + (console_row * VIDEO_FONT_HEIGHT) + video_logo_height)
264 264 #endif /* CONFIG_VIDEO_HW_CURSOR */
265 265  
266 266 #ifdef CONFIG_VIDEO_LOGO
... ... @@ -651,7 +651,8 @@
651 651  
652 652 static void console_back (void)
653 653 {
654   - CURSOR_OFF console_col--;
  654 + CURSOR_OFF;
  655 + console_col--;
655 656  
656 657 if (console_col < 0) {
657 658 console_col = CONSOLE_COLS - 1;
... ... @@ -674,7 +675,7 @@
674 675 is >= CONSOLE_COLS
675 676 */
676 677 if (console_col < CONSOLE_COLS)
677   - CURSOR_OFF
  678 + CURSOR_OFF;
678 679 console_row++;
679 680 console_col = 0;
680 681  
... ... @@ -690,7 +691,8 @@
690 691  
691 692 static void console_cr (void)
692 693 {
693   - CURSOR_OFF console_col = 0;
  694 + CURSOR_OFF;
  695 + console_col = 0;
694 696 }
695 697  
696 698 /*****************************************************************************/
... ... @@ -711,7 +713,8 @@
711 713 break;
712 714  
713 715 case 9: /* tab 8 */
714   - CURSOR_OFF console_col |= 0x0008;
  716 + CURSOR_OFF;
  717 + console_col |= 0x0008;
715 718 console_col &= ~0x0007;
716 719  
717 720 if (console_col >= CONSOLE_COLS)
... ... @@ -734,7 +737,8 @@
734 737 nl = 0;
735 738 }
736 739 }
737   -CURSOR_SET}
  740 + CURSOR_SET;
  741 +}
738 742  
739 743  
740 744 /*****************************************************************************/