From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
Haavard Skinnemoen <hskinnemoen@gmail.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Vinod Koul <vinod.koul@intel.com>,
Richard Weinberger <richard@nod.at>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Russell King <linux@armlinux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Wenyou Yang <wenyou.yang@atmel.com>,
Marek Vasut <marek.vasut@gmail.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Josh Wu <rainyfeeling@outlook.com>,
dmaengine@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Dan Williams <dan.j.williams@intel.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Hans-Christian
Subject: Re: [PATCH 1/5] gpio: Add the devm_get_index_gpiod_from_child() helper
Date: Mon, 30 Jan 2017 11:19:54 +0100 [thread overview]
Message-ID: <20170130111954.0f7ef130@bbrezillon> (raw)
In-Reply-To: <CACRpkdYsE_3twu6ZxTUD2A=YddU-Lq+0L+g12p7Ws99Aqjz97g@mail.gmail.com>
Hi Linus,
On Mon, 30 Jan 2017 10:49:23 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Jan 27, 2017 at 5:34 PM, Boris Brezillon
> <boris.brezillon@free-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@free-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
next prev parent reply other threads:[~2017-01-30 10:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-27 16:34 [PATCH 0/5] mtd: nand: Rework/cleanup the Atmel NAND driver Boris Brezillon
2017-01-27 16:34 ` [PATCH 1/5] gpio: Add the devm_get_index_gpiod_from_child() helper Boris Brezillon
2017-01-30 9:49 ` Linus Walleij
2017-01-30 10:19 ` Boris Brezillon [this message]
2017-01-27 16:34 ` [PATCH 2/5] dmaengine: Provide a wrapper for memcpy operations Boris Brezillon
2017-01-27 16:34 ` [PATCH 3/5] mtd: nand: Cleanup/rework the atmel_nand driver Boris Brezillon
2017-01-27 16:34 ` [PATCH 4/5] mtd: nand: atmel: Document the new DT bindings Boris Brezillon
2017-01-27 16:34 ` [PATCH 5/5] mtd: nand: Remove unused chip->write_page() hook Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170130111954.0f7ef130@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@atmel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=gnurou@gmail.com \
--cc=hskinnemoen@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=marek.vasut@gmail.com \
--cc=nicolas.ferre@atmel.com \
--cc=rainyfeeling@outlook.com \
--cc=richard@nod.at \
--cc=vinod.koul@intel.com \
--cc=wenyou.yang@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).