lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 Jan 2021 07:26:13 +0000
From:   "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
To:     "linus.walleij@...aro.org" <linus.walleij@...aro.org>
CC:     "mazziesaccount@...il.com" <mazziesaccount@...il.com>,
        linux-power <linux-power@...rohmeurope.com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "bgolaszewski@...libre.com" <bgolaszewski@...libre.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "lee.jones@...aro.org" <lee.jones@...aro.org>
Subject: Re: [PATCH 09/15] gpio: support ROHM BD71815 GPOs


On Mon, 2021-01-11 at 08:15 +0200, Matti Vaittinen wrote:
> 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@...rohmeurope.com> 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@...est-tech.com>
> > > although not so much of original is left.
> > > 
> > > Signed-off-by: Matti Vaittinen <matti.vaittinen@...rohmeurope.com
> > > >

// Snip

> > > +       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!)

/*
 * Bind devm lifetime to this platform device => use dev for devm.
 * also the prints should originate from this device.
 */
dev = &pdev->dev;
/* The device-tree and regmap come from MFD => use parent for that */
parent = dev->parent;

Maybe adding dev and parent variables + comments would clear it up?


Br,
	Matti Vaittinen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ