linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ludovic Desroches <ludovic.desroches@microchip.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
	linux-fbdev@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel@lists.freedesktop.org,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RESEND][PATCH] video: fbdev: atmel_lcdfb: convert to use GPIO descriptors
Date: Mon, 05 Feb 2018 15:31:37 +0000	[thread overview]
Message-ID: <20180205153137.GF2580@rfolt0960.corp.atmel.com> (raw)
In-Reply-To: <CAHp75Vc1npdmhrs80Cdj0t6RWpTtuXFkpXUQwxKDe=6vrZxkFA@mail.gmail.com>

On Mon, Feb 05, 2018 at 03:06:33PM +0200, Andy Shevchenko wrote:
> On Mon, Feb 5, 2018 at 10:47 AM, Ludovic Desroches
> <ludovic.desroches@microchip.com> wrote:
> > Use GPIO descriptors instead of relying on the old method.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> Though few nitpicks below.
> 
> 
> > --- a/drivers/video/fbdev/atmel_lcdfb.c
> > +++ b/drivers/video/fbdev/atmel_lcdfb.c
> > @@ -18,6 +18,7 @@
> >  #include <linux/delay.h>
> >  #include <linux/backlight.h>
> >  #include <linux/gfp.h>
> 
> > +#include <linux/gpio/consumer.h>
> 
> I think you forgot to remove of_gpio.h.

Right. I'll remove it.

> 
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> >  #include <linux/of_device.h>
> 
> >         struct device_node *display_np;
> >         struct device_node *timings_np;
> >         struct display_timings *timings;
> > -       enum of_gpio_flags flags;
> >         struct atmel_lcdfb_power_ctrl_gpio *og;
> >         bool is_gpio_power = false;
> >         int ret = -ENOENT;
> > -       int i, gpio;
> > +       int i;
> > +       struct gpio_desc *gpiod;
> 
> I would rather preserve reversed tree style, i.e. put longer line upper.

Ok.

> 
> 
> > +       for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) {
> > +               gpiod = devm_gpiod_get_index_optional(dev,
> > +                               "atmel,power-control", i, GPIOD_ASIS);
> > +               if (!gpiod)
> >                         continue;
> 
> What about IS_ERR() case?

if (!gpiod || IS_ERR(gpiod))
	continue;

Thanks.

> 
> >
> >                 og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
> >                 if (!og)
> >                         goto put_display_node;
> >
> > +               og->gpiod = gpiod;
> >                 is_gpio_power = true;
> >
> > +               ret = gpiod_direction_output(gpiod, gpiod_is_active_low(gpiod));
> >                 if (ret) {
> 
> I'm not sure this will be needed if you check IS_ERR() above.
> 

When in doubt, I keep it.

Regards

Ludovic

> > +                       dev_err(dev, "set direction output gpio atmel,power-control[%d] failed\n", i);
> >                         goto put_display_node;
> >                 }
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2018-02-05 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05  8:47 [RESEND][PATCH] video: fbdev: atmel_lcdfb: convert to use GPIO descriptors Ludovic Desroches
2018-02-05  9:16 ` Nicolas Ferre
2018-02-05 11:56 ` Linus Walleij
2018-02-06  7:37   ` Ludovic Desroches
2018-02-05 13:06 ` Andy Shevchenko
2018-02-05 15:31   ` Ludovic Desroches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180205153137.GF2580@rfolt0960.corp.atmel.com \
    --to=ludovic.desroches@microchip.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).