Re: [PATCH 3/6] OMAP: 2420SDP: Port the display driver to new DSS2

Tomi Valkeinen
2011-05-09T16:57:10Z

On Mon, 2011-05-09 at 11:21 +0300, Igor Grinberg wrote:
> Hi Tomi,
>
> On 05/09/11 10:36, Tomi Valkeinen wrote:
>
> > Port the old omapfb panel driver to DSS2. This patch changes the board
> > file only, the driver is ported in separate patch.
> >
> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Cc: Hunyue Yau <hyau@mvista.com>

<snip>

> > +static void __init sdp2430_display_init(void)
> > +{
> > + int r;
> > +
> > + r = gpio_request_one(SDP2430_LCD_PANEL_ENABLE_GPIO,
> > + GPIOF_OUT_INIT_LOW, "LCD reset");
> > + if (r) {
> > + printk(KERN_ERR "failed to get LCD reset GPIO\n");
> > + goto err0;
> > + }
> > +
> > + r = gpio_request_one(SDP2430_LCD_PANEL_BACKLIGHT_GPIO,
> > + GPIOF_OUT_INIT_LOW, "LCD Backlight");
> > + if (r) {
> > + printk(KERN_ERR "failed to get LCD backlight GPIO\n");
>
> can both printks be pr_err?
>
> > + goto err1;
> > + }
> > +
> > + omap_display_init(&sdp2430_dss_data);
> > +
> > + return;
> > +err1:
> > + gpio_free(SDP2430_LCD_PANEL_ENABLE_GPIO);
> > +err0:
> > + return;
> > +}
>
> I think using gpio_request_array() will be much cleaner here...

Right, thanks. It turned out much cleaner:

+static void __init sdp2430_display_init(void)
+{
+ int r;
+
+ static struct gpio gpios[] __initdata = {
+ { SDP2430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
+ "LCD reset" },
+ { SDP2430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW,
+ "LCD Backlight" },
+ };
+
+ r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
+ if (r) {
+ pr_err("Cannot request LCD GPIOs, error %d\n", r);
+ return;
+ }
+
+ omap_display_init(&sdp2430_dss_data);
+}

Tomi