Re: [PATCH 09/15] gpio: support ROHM BD71815 GPOs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Linus,

Thanks a lot for review!

On Sat, 2021-01-09 at 01:45 +0100, Linus Walleij wrote:
> On Fri, Jan 8, 2021 at 2:39 PM Matti Vaittinen
> <matti.vaittinen@xxxxxxxxxxxxxxxxx> wrote:
> 
> > Support GPO(s) found from ROHM BD71815 power management IC. The IC
> > has two
> > GPO pins but only one is properly documented in data-sheet. The
> > driver
> > exposes by default only the documented GPO. The second GPO is
> > connected to
> > E5 pin and is marked as GND in data-sheet. Control for this
> > undocumented
> > pin can be enabled using a special DT property.
> > 
> > This driver is derived from work by Peter Yang <
> > yanglsh@xxxxxxxxxxxxxxx>
> > although not so much of original is left.
> > 
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
> 
> Overall this looks good!
> 
> > +       depends on MFD_ROHM_BD71828
> 
> I suppose this makes i possible to merge out-of-order with the
> core patches actually.

Actually not. MFD_ROHM_BD71828 is existing config as this BD71815 uses
same MFD driver with BD71828. So MFD headers should be in before
merging the depending sub-device drivers.

> 
> > +#define DEBUG
> 
> Why? Development artifact?

Ouch. Thanks for spotting it :) I'll get rid of that.

> > +#include <linux/kthread.h>
> 
> You certainly do not need this.
> 
> > +#include <linux/mfd/rohm-bd71815.h>
> > +#include <linux/mfd/rohm-generic.h>
> 
> I guess registers come from these? Do you need both?
> Add a comment about what they provide.

Ok. Can do. (registers, I will recheck if I can get rid of including
the rohm-generic)

> 
> > +       g->chip.ngpio = 1;
> > +       if (g->e5_pin_is_gpo)
> > +               g->chip.ngpio = 2;
> 
> Overwriting value, how not elegant.
> 
> if (g->e5_pin_is_gpo)
>   g->chip.ngpio = 2;
> else
>   g->chip.ngpio = 1;

matter of taste I'd say :) As I would say about functions named like
_foo() ;) Not a poin I would fight over though - I can change this :]


> > +       g->chip.parent = pdev->dev.parent;
> > +       g->chip.of_node = pdev->dev.parent->of_node;
> > +       g->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > +       g->dev = &pdev->dev;
> > +
> > +       ret = devm_gpiochip_add_data(&pdev->dev, &g->chip, g);
> > +       if (ret < 0) {
> > +               dev_err(&pdev->dev, "could not register gpiochip,
> > %d\n", ret);
> > +               return ret;
> > +       }
> 
> It's a bit confusing how you use pdev->dev.parent for some stuff
> and &pdev->dev for some.
> 
> What about assinging
> 
> struct device *dev = pdev->dev.parent;
> 
> and use dev for all the calls, it looks like it'd work fine.

I wouldn't bind the lifetime of devm functions to the parent device. I
am not sure if it would work - what happens we bind lifetime of XX to
parent device - and next call at probe fails (for example with
DEFERRED?) I _assume_ the XX bound to parent is not released? (Please,
do correct me if I am wrong!)

Br,
    Matti Vaittinen







[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux