summaryrefslogtreecommitdiff
path: root/drivers/uio/uio_pdrv_genirq.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2019-08-16 00:28:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-04 14:42:43 +0300
commitb0297622a9726b929ed9f73eaa7605fd6a55df20 (patch)
treee15f62a2a0a0908202bbb9aeeecd67ade701dbe2 /drivers/uio/uio_pdrv_genirq.c
parent13c1d4b30e52e8d79b0e01ae3894cf8399572e1d (diff)
downloadlinux-b0297622a9726b929ed9f73eaa7605fd6a55df20.tar.xz
uio: uio_pdrv_genirq: Make UIO name controllable via DT node property
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. Signed-off-by: Daniel Mack <daniel@zonque.org> Link: https://lore.kernel.org/r/20190815212807.25058-1-daniel@zonque.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio/uio_pdrv_genirq.c')
-rw-r--r--drivers/uio/uio_pdrv_genirq.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 10688d79d180..1303b165055b 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -102,12 +102,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);
@@ -115,8 +118,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 */
}