Patchwork [U-Boot,05/10] common/lcd.c: cleanup use of global variables

login
register
mail settings
Submitter Jeroen Hofstee
Date Jan. 12, 2013, 10:07 p.m.
Message ID <1358028480-4979-6-git-send-email-jeroen@myspectrum.nl>
Download mbox | patch
Permalink /patch/211562/
State Superseded
Delegated to: Anatolij Gustschin
Headers show

Comments

Jeroen Hofstee - Jan. 12, 2013, 10:07 p.m.
console_col, console_row, lcd_line_length, lcd_console_address had
to be declared in board / driver specific code, but were not actually
used there. Get rid of the global variables.

Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Bo Shen <voice.shen@atmel.com>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stelian Pop <stelian@popies.net>
Cc: Tom Warren <twarren@nvidia.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 board/mcc200/lcd.c           |    6 ------
 common/lcd.c                 |    6 ++++++
 drivers/video/atmel_hlcdfb.c |    6 ------
 drivers/video/atmel_lcdfb.c  |    6 ------
 drivers/video/exynos_fb.c    |    6 ------
 drivers/video/mpc8xx_lcd.c   |    6 ------
 drivers/video/pxa_lcd.c      |    6 ------
 drivers/video/tegra.c        |    6 ------
 include/lcd.h                |    5 -----
 9 files changed, 6 insertions(+), 47 deletions(-)
Bo Shen - Jan. 16, 2013, 1:23 a.m.
On 1/13/2013 6:07, Jeroen Hofstee wrote:
> console_col, console_row, lcd_line_length, lcd_console_address had
> to be declared in board / driver specific code, but were not actually
> used there. Get rid of the global variables.
>
> Cc: Alessandro Rubini <rubini@unipv.it>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Bo Shen <voice.shen@atmel.com>
> Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stelian Pop <stelian@popies.net>
> Cc: Tom Warren <twarren@nvidia.com>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---
>   board/mcc200/lcd.c           |    6 ------
>   common/lcd.c                 |    6 ++++++
>   drivers/video/atmel_hlcdfb.c |    6 ------
>   drivers/video/atmel_lcdfb.c  |    6 ------
>   drivers/video/exynos_fb.c    |    6 ------
>   drivers/video/mpc8xx_lcd.c   |    6 ------
>   drivers/video/pxa_lcd.c      |    6 ------
>   drivers/video/tegra.c        |    6 ------
>   include/lcd.h                |    5 -----
>   9 files changed, 6 insertions(+), 47 deletions(-)
>
> diff --git a/board/mcc200/lcd.c b/board/mcc200/lcd.c
> index 0f3f585..caf8d8b 100644
> --- a/board/mcc200/lcd.c
> +++ b/board/mcc200/lcd.c
> @@ -68,16 +68,10 @@ vidinfo_t panel_info = {
>   	LCD_WIDTH, LCD_HEIGHT, LCD_BPP
>   };
>
> -int lcd_line_length;
> -
>   /*
>    * Frame buffer memory information
>    */
>   void *lcd_base;			/* Start of framebuffer memory  */
> -void *lcd_console_address;	/* Start of console buffer      */
> -
> -short console_col = 0;
> -short console_row = 0;
>
>   /*
>    *  The device we use to communicate with PSoC
> diff --git a/common/lcd.c b/common/lcd.c
> index b67724e..d3fd68d 100644
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -99,9 +99,15 @@ static void lcd_setbgcolor(int color);
>
>   static int lcd_color_fg;
>   static int lcd_color_bg;
> +static int lcd_line_length;
>
>   char lcd_is_enabled = 0;
>
> +static short console_col;
> +static short console_row;
> +
> +static void *lcd_console_address;
> +
>   static char lcd_flush_dcache;	/* 1 to flush dcache after each lcd update */
>
>
> diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
> index e74eb65..32626cf 100644
> --- a/drivers/video/atmel_hlcdfb.c
> +++ b/drivers/video/atmel_hlcdfb.c
> @@ -29,13 +29,7 @@
>   #include <lcd.h>
>   #include <atmel_hlcdc.h>
>
> -int lcd_line_length;
> -
>   void *lcd_base;				/* Start of framebuffer memory	*/
> -void *lcd_console_address;		/* Start of console buffer	*/
> -
> -short console_col;
> -short console_row;
>
>   /* configurable parameters */
>   #define ATMEL_LCDC_CVAL_DEFAULT		0xc8
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index d96f175..370d9ca 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -29,13 +29,7 @@
>   #include <lcd.h>
>   #include <atmel_lcdc.h>
>
> -int lcd_line_length;
> -
>   void *lcd_base;				/* Start of framebuffer memory	*/
> -void *lcd_console_address;		/* Start of console buffer	*/
> -
> -short console_col;
> -short console_row;
>
>   /* configurable parameters */
>   #define ATMEL_LCDC_CVAL_DEFAULT		0xc8

For Atmel part, it is ok for me.

Acked-by: Bo Shen <voice.shen@atmel.com>

Best Regards,
Bo Shen

> diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
> index 3dd6100..3e5f868 100644
> --- a/drivers/video/exynos_fb.c
> +++ b/drivers/video/exynos_fb.c
> @@ -33,13 +33,7 @@
>
>   #include "exynos_fb.h"
>
> -int lcd_line_length;
> -
>   void *lcd_base;
> -void *lcd_console_address;
> -
> -short console_col;
> -short console_row;
>
>   static unsigned int panel_width, panel_height;
>
> diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c
> index 4fd44ac..26ad432 100644
> --- a/drivers/video/mpc8xx_lcd.c
> +++ b/drivers/video/mpc8xx_lcd.c
> @@ -256,16 +256,10 @@ vidinfo_t panel_info = {
>   /*----------------------------------------------------------------------*/
>
>
> -int lcd_line_length;
> -
>   /*
>    * Frame buffer memory information
>    */
>   void *lcd_base;			/* Start of framebuffer memory	*/
> -void *lcd_console_address;	/* Start of console buffer	*/
> -
> -short console_col;
> -short console_row;
>
>   /************************************************************************/
>
> diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c
> index 25747b1..57243ce 100644
> --- a/drivers/video/pxa_lcd.c
> +++ b/drivers/video/pxa_lcd.c
> @@ -332,13 +332,7 @@ void lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue);
>   void lcd_ctrl_init	(void *lcdbase);
>   void lcd_enable	(void);
>
> -int lcd_line_length;
> -
>   void *lcd_base;			/* Start of framebuffer memory	*/
> -void *lcd_console_address;		/* Start of console buffer	*/
> -
> -short console_col;
> -short console_row;
>
>   static int pxafb_init_mem (void *lcdbase, vidinfo_t *vid);
>   static void pxafb_setup_gpio (vidinfo_t *vid);
> diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
> index 26a96a5..0d1cfa9 100644
> --- a/drivers/video/tegra.c
> +++ b/drivers/video/tegra.c
> @@ -60,13 +60,7 @@ enum {
>   	LCD_MAX_LOG2_BPP	= 4,		/* 2^4 = 16 bpp */
>   };
>
> -int lcd_line_length;
> -
>   void *lcd_base;			/* Start of framebuffer memory	*/
> -void *lcd_console_address;	/* Start of console buffer	*/
> -
> -short console_col;
> -short console_row;
>
>   vidinfo_t panel_info = {
>   	/* Insert a value here so that we don't end up in the BSS */
> diff --git a/include/lcd.h b/include/lcd.h
> index 7d8c41f..b8eea9c 100644
> --- a/include/lcd.h
> +++ b/include/lcd.h
> @@ -31,16 +31,11 @@
>
>   extern char lcd_is_enabled;
>
> -extern int lcd_line_length;
> -
>   /*
>    * Frame buffer memory information
>    */
>   extern void *lcd_base;			/* Start of framebuffer memory	*/
> -extern void *lcd_console_address;	/* Start of console buffer	*/
>
> -extern short console_col;
> -extern short console_row;
>   extern struct vidinfo panel_info;
>
>   extern void lcd_ctrl_init (void *lcdbase);
>

Patch

diff --git a/board/mcc200/lcd.c b/board/mcc200/lcd.c
index 0f3f585..caf8d8b 100644
--- a/board/mcc200/lcd.c
+++ b/board/mcc200/lcd.c
@@ -68,16 +68,10 @@  vidinfo_t panel_info = {
 	LCD_WIDTH, LCD_HEIGHT, LCD_BPP
 };
 
-int lcd_line_length;
-
 /*
  * Frame buffer memory information
  */
 void *lcd_base;			/* Start of framebuffer memory  */
-void *lcd_console_address;	/* Start of console buffer      */
-
-short console_col = 0;
-short console_row = 0;
 
 /*
  *  The device we use to communicate with PSoC
diff --git a/common/lcd.c b/common/lcd.c
index b67724e..d3fd68d 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -99,9 +99,15 @@  static void lcd_setbgcolor(int color);
 
 static int lcd_color_fg;
 static int lcd_color_bg;
+static int lcd_line_length;
 
 char lcd_is_enabled = 0;
 
+static short console_col;
+static short console_row;
+
+static void *lcd_console_address;
+
 static char lcd_flush_dcache;	/* 1 to flush dcache after each lcd update */
 
 
diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index e74eb65..32626cf 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -29,13 +29,7 @@ 
 #include <lcd.h>
 #include <atmel_hlcdc.h>
 
-int lcd_line_length;
-
 void *lcd_base;				/* Start of framebuffer memory	*/
-void *lcd_console_address;		/* Start of console buffer	*/
-
-short console_col;
-short console_row;
 
 /* configurable parameters */
 #define ATMEL_LCDC_CVAL_DEFAULT		0xc8
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index d96f175..370d9ca 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -29,13 +29,7 @@ 
 #include <lcd.h>
 #include <atmel_lcdc.h>
 
-int lcd_line_length;
-
 void *lcd_base;				/* Start of framebuffer memory	*/
-void *lcd_console_address;		/* Start of console buffer	*/
-
-short console_col;
-short console_row;
 
 /* configurable parameters */
 #define ATMEL_LCDC_CVAL_DEFAULT		0xc8
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 3dd6100..3e5f868 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -33,13 +33,7 @@ 
 
 #include "exynos_fb.h"
 
-int lcd_line_length;
-
 void *lcd_base;
-void *lcd_console_address;
-
-short console_col;
-short console_row;
 
 static unsigned int panel_width, panel_height;
 
diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c
index 4fd44ac..26ad432 100644
--- a/drivers/video/mpc8xx_lcd.c
+++ b/drivers/video/mpc8xx_lcd.c
@@ -256,16 +256,10 @@  vidinfo_t panel_info = {
 /*----------------------------------------------------------------------*/
 
 
-int lcd_line_length;
-
 /*
  * Frame buffer memory information
  */
 void *lcd_base;			/* Start of framebuffer memory	*/
-void *lcd_console_address;	/* Start of console buffer	*/
-
-short console_col;
-short console_row;
 
 /************************************************************************/
 
diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c
index 25747b1..57243ce 100644
--- a/drivers/video/pxa_lcd.c
+++ b/drivers/video/pxa_lcd.c
@@ -332,13 +332,7 @@  void lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue);
 void lcd_ctrl_init	(void *lcdbase);
 void lcd_enable	(void);
 
-int lcd_line_length;
-
 void *lcd_base;			/* Start of framebuffer memory	*/
-void *lcd_console_address;		/* Start of console buffer	*/
-
-short console_col;
-short console_row;
 
 static int pxafb_init_mem (void *lcdbase, vidinfo_t *vid);
 static void pxafb_setup_gpio (vidinfo_t *vid);
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
index 26a96a5..0d1cfa9 100644
--- a/drivers/video/tegra.c
+++ b/drivers/video/tegra.c
@@ -60,13 +60,7 @@  enum {
 	LCD_MAX_LOG2_BPP	= 4,		/* 2^4 = 16 bpp */
 };
 
-int lcd_line_length;
-
 void *lcd_base;			/* Start of framebuffer memory	*/
-void *lcd_console_address;	/* Start of console buffer	*/
-
-short console_col;
-short console_row;
 
 vidinfo_t panel_info = {
 	/* Insert a value here so that we don't end up in the BSS */
diff --git a/include/lcd.h b/include/lcd.h
index 7d8c41f..b8eea9c 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -31,16 +31,11 @@ 
 
 extern char lcd_is_enabled;
 
-extern int lcd_line_length;
-
 /*
  * Frame buffer memory information
  */
 extern void *lcd_base;			/* Start of framebuffer memory	*/
-extern void *lcd_console_address;	/* Start of console buffer	*/
 
-extern short console_col;
-extern short console_row;
 extern struct vidinfo panel_info;
 
 extern void lcd_ctrl_init (void *lcdbase);