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] [day] [month] [year] [list]
Message-ID: <20170130111954.0f7ef130@bbrezillon>
Date:   Mon, 30 Jan 2017 11:19:54 +0100
From:   Boris Brezillon <boris.brezillon@...e-electrons.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Alexandre Courbot <gnurou@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Brian Norris <computersforpeace@...il.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Vinod Koul <vinod.koul@...el.com>,
        Richard Weinberger <richard@....at>,
        Nicolas Ferre <nicolas.ferre@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Wenyou Yang <wenyou.yang@...el.com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        Josh Wu <rainyfeeling@...look.com>, dmaengine@...r.kernel.org,
        Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Hans-Christian Egtvedt <egtvedt@...fundet.no>,
        David Woodhouse <dwmw2@...radead.org>,
        Cyrille Pitchen <cyrille.pitchen@...el.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        Haavard Skinnemoen <hskinnemoen@...il.com>
Subject: Re: [PATCH 1/5] gpio: Add the devm_get_index_gpiod_from_child()
 helper

Hi Linus,

On Mon, 30 Jan 2017 10:49:23 +0100
Linus Walleij <linus.walleij@...aro.org> wrote:

> On Fri, Jan 27, 2017 at 5:34 PM, Boris Brezillon
> <boris.brezillon@...e-electrons.com> wrote:
> 
> > devm_get_gpiod_from_child() currently allows GPIO users to request a GPIO
> > that is defined in a child fwnode instead of directly in the device
> > fwnode. Extend this API by adding the devm_get_index_gpiod_from_child()
> > helpers which does the same except you can also specify an index in case
> > the 'xx-gpios' property describe several GPIOs.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@...e-electrons.com>  
> 
> Cc Russell who faced this problem in the mvebu PCI driver (IIRC).
> 
> (...)
> 
> > +struct gpio_desc *devm_get_index_gpiod_from_child(struct device *dev,
> > +                                                 const char *con_id,
> > +                                                 int index,
> > +                                                 struct fwnode_handle *child)
> >  {
> >         static const char * const suffixes[] = { "gpios", "gpio" };
> >         char prop_name[32]; /* 32 is max size of property name */
> > @@ -154,7 +157,7 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
> >                         snprintf(prop_name, sizeof(prop_name), "%s",
> >                                                                suffixes[i]);
> >
> > -               desc = fwnode_get_named_gpiod(child, prop_name);
> > +               desc = fwnode_get_named_gpiod(child, prop_name, index);
> >                 if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
> >                         break;
> >         }
> > @@ -168,6 +171,23 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
> >
> >         return desc;
> >  }
> > +EXPORT_SYMBOL(devm_get_index_gpiod_from_child);  
> 
> Rename this devm_fwnode_get_index_gpiod_from_child()
> so that it fits the namespace of the other fwnode functions.

Okay.

> 
> > + * devm_get_gpiod_from_child - get a GPIO descriptor from a device's child node
> > + * @dev:       GPIO consumer
> > + * @con_id:    function within the GPIO consumer
> > + * @child:     firmware node (child of @dev)
> > + *
> > + * GPIO descriptors returned from this function are automatically disposed on
> > + * driver detach.
> > + */
> > +struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
> > +                                           const char *con_id,
> > +                                           struct fwnode_handle *child)
> > +{
> > +       return devm_get_index_gpiod_from_child(dev, con_id, 0, child);
> > +}  
> 
> Take the opportunity to rename this devm_fwnode_get_gpiod_from_child()
> as well.

Sure, I'll provide a separate patch renaming this function.

Thanks,

Boris

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ