[PATCH v8] ARM : mx35: 3ds-board: add framebuffer device

Wu Guoxing b39297 at freescale.com
Thu Mar 15 04:02:36 EDT 2012


Hi Baruch:

On Wed, Mar 14, 2012 at 07:02:38AM +0200, Baruch Siach wrote:
> Hi Wu,
> 
> On Wed, Mar 14, 2012 at 10:10:54AM +0800, Wu Guoxing wrote:
> > From: wu guoxing <b39297 at freescale.com>
> > 
> > This patch adds framebuffer support for freescale mx35 3ds board
> > 
> > Signed-off-by: Wu Guoxing <b39297 at freescale.com>
> > ---
> 
> [snip]
> 
> > +static int lcd_power_gpio = -ENXIO;
> 
> Since this is only used in mx35_3ds_lcd_set_power() below, can't it be local 
> to that routine?
> 
when I search the whole kernel code, I didn't find much using of function local static
variable, and even if the static variable is used only by that one function.

and we need this variable to be global, to avoid search the gpiochip every time.
> > +
> > +static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip,
> > +						     void *data)
> > +{
> > +	return !strcmp(chip->label, data);
> > +}
> > +
> > +static void mx35_3ds_lcd_set_power(
> > +				struct plat_lcd_data *pd, unsigned int power)
> > +{
> > +	struct gpio_chip *chip;
> > +
> > +	if (!gpio_is_valid(lcd_power_gpio)) {
> > +		chip = gpiochip_find(
> > +				"mc9s08dz60", mc9s08dz60_gpiochip_match);
> > +		if (chip) {
> > +			lcd_power_gpio =
> > +				chip->base + GPIO_MC9S08DZ60_LCD_ENABLE;
> > +			if (gpio_request(lcd_power_gpio, "lcd_power") < 0) {
> > +				pr_err("error: gpio already requested!\n");
> > +				lcd_power_gpio = -ENXIO;
> > +			}
> > +		} else {
> > +			pr_err("error: didn't find mc9s08dz60 gpio chip\n");
> > +		}
> > +	}
> > +
> > +	if (gpio_is_valid(lcd_power_gpio))
> > +		gpio_set_value_cansleep(lcd_power_gpio, power);
> > +}
> 
> baruch
> 
> -- 
>      http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
>    - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
> 




More information about the linux-arm-kernel mailing list