From: Daniel Mack <daniel@zonque.org>
To: gregkh@linuxfoundation.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] uio: uio_pdrv_genirq: Make UIO name controllable via DT node property
Date: Tue, 27 Aug 2019 18:07:04 +0200 [thread overview]
Message-ID: <3f65e92e-350e-d414-75c4-8680932b39d1@zonque.org> (raw)
In-Reply-To: <20190815212807.25058-1-daniel@zonque.org>
Hi Greg,
On 15/8/2019 11:28 PM, Daniel Mack wrote:
> When probed via DT, the uio_pdrv_genirq driver currently uses the name
> of the node and exposes that as name of the UIO device to userspace.
>
> This doesn't work for systems where multiple nodes with the same name
> (but different unit addresses) are present, or for systems where the
> node names are auto-generated by a third-party tool.
>
> This patch adds the possibility to read the UIO name from the optional
> "linux,uio-name" property.
Any opinion on this one?
Thanks,
Daniel
>
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
> drivers/uio/uio_pdrv_genirq.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
> index 6c759934bff3..24d60eb1bda5 100644
> --- a/drivers/uio/uio_pdrv_genirq.c
> +++ b/drivers/uio/uio_pdrv_genirq.c
> @@ -105,12 +105,15 @@ static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)
> static int uio_pdrv_genirq_probe(struct platform_device *pdev)
> {
> struct uio_info *uioinfo = dev_get_platdata(&pdev->dev);
> + struct device_node *node = pdev->dev.of_node;
> struct uio_pdrv_genirq_platdata *priv;
> struct uio_mem *uiomem;
> int ret = -EINVAL;
> int i;
>
> - if (pdev->dev.of_node) {
> + if (node) {
> + const char *name;
> +
> /* alloc uioinfo for one device */
> uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo),
> GFP_KERNEL);
> @@ -118,8 +121,13 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "unable to kmalloc\n");
> return -ENOMEM;
> }
> - uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
> - pdev->dev.of_node);
> +
> + if (!of_property_read_string(node, "linux,uio-name", &name))
> + uioinfo->name = devm_kstrdup(&pdev->dev, name, GFP_KERNEL);
> + else
> + uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> + "%pOFn", node);
> +
> uioinfo->version = "devicetree";
> /* Multiple IRQs are not supported */
> }
>
next prev parent reply other threads:[~2019-08-27 16:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 21:28 Daniel Mack
2019-08-15 21:28 ` [PATCH v2 2/2] uio: Documentation: Add information on using uio_pdrv_genirq with DT Daniel Mack
2019-08-27 16:07 ` Daniel Mack [this message]
2019-08-27 17:04 ` [PATCH v2 1/2] uio: uio_pdrv_genirq: Make UIO name controllable via DT node property Greg KH
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=3f65e92e-350e-d414-75c4-8680932b39d1@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®