tegra: video: Remove the static variables

We can move the static variables into the driver-private data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
This commit is contained in:
Simon Glass 2016-01-30 16:37:57 -07:00 committed by Tom Warren
parent 9e6866d3b6
commit f20b2c0671
1 changed files with 15 additions and 16 deletions

View File

@ -2,7 +2,7 @@
* Copyright (c) 2011 The Chromium OS Authors. * Copyright (c) 2011 The Chromium OS Authors.
* SPDX-License-Identifier: GPL-2.0+ * SPDX-License-Identifier: GPL-2.0+
*/ */
#define DEBUG
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <fdtdec.h> #include <fdtdec.h>
@ -31,11 +31,10 @@ enum stage_t {
STAGE_DONE, STAGE_DONE,
}; };
static enum stage_t stage; /* Current stage we are at */
static unsigned long timer_next; /* Time we can move onto next stage */
/* Information about the display controller */ /* Information about the display controller */
struct tegra_lcd_priv { struct tegra_lcd_priv {
enum stage_t stage; /* Current stage we are at */
unsigned long timer_next; /* Time we can move onto next stage */
int width; /* width in pixels */ int width; /* width in pixels */
int height; /* height in pixels */ int height; /* height in pixels */
int bpp; /* number of bits per pixel */ int bpp; /* number of bits per pixel */
@ -497,10 +496,10 @@ static int fdt_decode_lcd(const void *blob, struct tegra_lcd_priv *priv)
*/ */
static int handle_stage(const void *blob, struct tegra_lcd_priv *priv) static int handle_stage(const void *blob, struct tegra_lcd_priv *priv)
{ {
debug("%s: stage %d\n", __func__, stage); debug("%s: stage %d\n", __func__, priv->stage);
/* do the things for this stage */ /* do the things for this stage */
switch (stage) { switch (priv->stage) {
case STAGE_START: case STAGE_START:
/* /*
* It is possible that the FDT has requested that the LCD be * It is possible that the FDT has requested that the LCD be
@ -542,12 +541,12 @@ static int handle_stage(const void *blob, struct tegra_lcd_priv *priv)
} }
/* set up timer for next stage */ /* set up timer for next stage */
timer_next = timer_get_us(); priv->timer_next = timer_get_us();
if (stage < FDT_LCD_TIMINGS) if (priv->stage < FDT_LCD_TIMINGS)
timer_next += priv->panel_timings[stage] * 1000; priv->timer_next += priv->panel_timings[priv->stage] * 1000;
/* move to next stage */ /* move to next stage */
stage++; priv->stage++;
return 0; return 0;
} }
@ -571,14 +570,14 @@ static int handle_stage(const void *blob, struct tegra_lcd_priv *priv)
static int tegra_lcd_check_next_stage(const void *blob, static int tegra_lcd_check_next_stage(const void *blob,
struct tegra_lcd_priv *priv, int wait) struct tegra_lcd_priv *priv, int wait)
{ {
if (stage == STAGE_DONE) if (priv->stage == STAGE_DONE)
return 0; return 0;
do { do {
/* wait if we need to */ /* wait if we need to */
debug("%s: stage %d\n", __func__, stage); debug("%s: stage %d\n", __func__, priv->stage);
if (stage != STAGE_START) { if (priv->stage != STAGE_START) {
int delay = timer_next - timer_get_us(); int delay = priv->timer_next - timer_get_us();
if (delay > 0) { if (delay > 0) {
if (wait) if (wait)
@ -590,8 +589,8 @@ static int tegra_lcd_check_next_stage(const void *blob,
if (handle_stage(blob, priv)) if (handle_stage(blob, priv))
return -1; return -1;
} while (wait && stage != STAGE_DONE); } while (wait && priv->stage != STAGE_DONE);
if (stage == STAGE_DONE) if (priv->stage == STAGE_DONE)
debug("%s: LCD init complete\n", __func__); debug("%s: LCD init complete\n", __func__);
return 0; return 0;