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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADiBU3-DO0tQhEC9f+p06kDFZsk8vDVu_H74PWKSLrBaW5zB5g@mail.gmail.com>
Date:   Wed, 29 Jun 2022 17:02:57 +0800
From:   ChiYuan Huang <u0084500@...il.com>
To:     AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
Cc:     Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        chiaen_wu@...htek.com, alice_chen@...htek.com,
        lkml <linux-kernel@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        ChiYuan Huang <cy_huang@...htek.com>
Subject: Re: [PATCH 1/2] regulator: mt6370: Use 'fwnode_gpiod_get_index' to
 fix gpio parsing

AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com> 於
2022年6月29日 週三 下午4:23寫道:
>
> Il 29/06/22 03:41, cy_huang ha scritto:
> > From: ChiYuan Huang <cy_huang@...htek.com>
> >
> > From the common binding, 'enable-gpio' or 'enable-gpios' are all well
> > for external 'enable' gpio.
> >
> > 'gpiod_get_from_of_node' only parse the 'enable' property, it need to
> > add the gpio suffix. It's more convenient to use fwnode_gpiod_get_index.
> > Although fwnode parsing is not preferred, but 'of_parse_cb' already can
> > guarantee the callback will only be used by regulator of_node parsing.
> >
> > Signed-off-by: ChiYuan Huang <cy_huang@...htek.com>
> > ---
> >   drivers/regulator/mt6370-regulator.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/regulator/mt6370-regulator.c b/drivers/regulator/mt6370-regulator.c
> > index bc356b4..949b2c7 100644
> > --- a/drivers/regulator/mt6370-regulator.c
> > +++ b/drivers/regulator/mt6370-regulator.c
> > @@ -153,7 +153,8 @@ static int mt6370_of_parse_cb(struct device_node *np,
> >       struct gpio_desc *enable_gpio;
> >       int ret;
> >
> > -     enable_gpio = gpiod_get_from_of_node(np, "enable", 0, GPIOD_OUT_HIGH |
> > +     enable_gpio = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
>
> Since this driver is never calling gpiod_put(), you can even fix that in one shot.
>
> Just use devm_fwnode_gpiod_get() here, as it's guaranteed that priv->dev is
> initialized at this time.
>
Refer to the regulator framework,it will take over the gpio_desc.
You cannot use devm version for 'gpiod_get'.
> Cheers,
> Angelo
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ