lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v5 2/2] gpio: add a reusable generic gpio_chip using regmap
On Thu, May 28, 2020 at 4:00 PM Michael Walle <michael@walle.cc> wrote:
> Am 2020-05-28 13:45, schrieb Andy Shevchenko:
> > On Thu, May 28, 2020 at 7:04 AM Michael Walle <michael@walle.cc> wrote:

> > More comments from me below.
>
> Thanks for the review.

You are welcome! Thanks for doing this actually.

(So, the not commented points I think you agreed with)

...

> >> # Device drivers. Generally keep list sorted alphabetically
> >
> > Hmm...
> >
> >> +obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o
> >> obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o
> >
> > ...is it?
>
> That's because gpio-regmap.o seems not be a driver and more of a generic
> thing (like gpio-generic.o) and gpio-generic.o has another rule two
> lines
> below and I don't want to put gpio-regmap.o in between.

OK!

...

> >> + if (gpio->reg_dir_out_base) {
> >> + base = gpio_regmap_addr(gpio->reg_dir_out_base);
> >> + invert = 0;
> >> + } else if (gpio->reg_dir_in_base) {
> >> + base = gpio_regmap_addr(gpio->reg_dir_in_base);
> >> + invert = 1;
> >> + } else {
> >
> >> + return GPIO_LINE_DIRECTION_IN;
> >
> > Hmm... Doesn't it an erroneous case and we basically shouldn't be here?
>
> yeah, I'll return -EOPNOTSUPP. Better than just ignoring, right?

Yes, that's what I meant.

...

> >> + if (!!(val & mask) ^ invert)
> >> + return GPIO_LINE_DIRECTION_OUT;
> >
> >> + else
> >
> > Redundant 'else'.
>
> IMHO, That looks really strange. like it has nothing to do with the
> if statement. I'd like to keep that one.

We have many drivers done like that, but it's minor, so, up to you and
maintainers.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-05-28 15:43    [W:0.046 / U:46.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site