mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maciej Andrzejewski ICEYE <maciej.andrzejewski@m-works.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	chris.packham@alliedtelesis.co.nz, daniel@zonque.org,
	andriy.shevchenko@linux.intel.com, sakari.ailus@linux.intel.com,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	maciej.andrzejewski@m-works.net
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Daniel Mack <daniel@zonque.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	Maciej Andrzejewski ICEYE <maciej.andrzejewski@m-works.net>
Subject: [PATCH] uio: uio_pdrv_genirq: restore UIO name without the unit address
Date: Thu, 20 Aug 2026 16:01:23 +0200	[thread overview]
Message-ID: <20260820140119.1546932-1-maciej.andrzejewski@m-works.net> (raw)

Commit 90fa0280553a ("uio_pdrv_genirq: convert to use device_property
APIs") switched the driver to the device_property API so that a UIO
device can also be described through an ACPI overlay. As part of that
conversion the default name handed to userspace changed from "%pOFn" to
"%pfwP".

The two specifiers are not interchangeable. The printk format
documentation defines %pfwP as the node name including an address if
there is one, while %pOFn prints the device tree node name with the unit
address stripped. A node named "dma@a0000000" therefore appeared in
/sys/class/uio/uioN/name as "dma" up to v6.9 and as "dma@a0000000" from
v6.10 onwards.

That name is the only stable handle userspace has for a UIO device,
because the uioN index follows probe order. Applications that resolve a
device by name, for instance through the libuio uio_find_by_uio_name()
helper, stop finding it.

Nothing in the conversion suggests the rename was intended.
Documentation/driver-api/uio-howto.rst still states that the node's name
without the unit address is exposed as the name for the UIO device in
userspace, and uio_dmem_genirq still builds its name with %pOFn. The
"linux,uio-name" property added by commit b0297622a972 ("uio:
uio_pdrv_genirq: Make UIO name controllable via DT node property")
already lets a board distinguish several identically named nodes, so the
default does not need to carry the unit address.

fwnode has no equivalent of the %pOFn name-only modifier, which is
likely why the closest specifier was picked. Print device tree nodes
through %pOFn and leave every other firmware node type on %pfwP. This
driver could not be probed from ACPI before 90fa0280553a, so ACPI
naming is unaffected.

Should the unit address in the default name turn out to be wanted after
all, then uio-howto.rst is the file that needs the change instead, and I
am happy to send that patch rather than this one.

Fixes: 90fa0280553a ("uio_pdrv_genirq: convert to use device_property APIs")
Cc: stable@vger.kernel.org
Signed-off-by: Maciej Andrzejewski ICEYE <maciej.andrzejewski@m-works.net>
---

Notes:
    Found on a Zynq UltraScale+ platform where FPGA blocks are exposed
    through generic-uio nodes. Userspace uses libuio and resolves those
    devices by name, so the applications stopped finding them after a move
    from 4.19 to 6.12.

    The single generic-uio node in tree is renamed the same way:
    uio@d0000000 in arch/arc/boot/dts/vdk_axs10x_mb.dtsi reads back as "uio"
    before v6.10 and as "uio@d0000000" after it.

    Build tested on x86_64 with W=1 and CONFIG_UIO_PDRV_GENIRQ=m, once with
    CONFIG_OF=y and once with CONFIG_OF=n. No warnings either way.

 drivers/uio/uio_pdrv_genirq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 0c8d73e7be52..27268c8d1b94 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -128,6 +128,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)

 		if (!device_property_read_string(&pdev->dev, "linux,uio-name", &name))
 			uioinfo->name = devm_kstrdup(&pdev->dev, name, GFP_KERNEL);
+		else if (is_of_node(node))
+			uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+						       "%pOFn", to_of_node(node));
 		else
 			uioinfo->name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 						       "%pfwP", node);
--
2.50.1

             reply	other threads:[~2026-08-20 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 14:01 Maciej Andrzejewski ICEYE [this message]
2026-08-20 20:55 ` Sakari Ailus

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=20260820140119.1546932-1-maciej.andrzejewski@m-works.net \
    --to=maciej.andrzejewski@m-works.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=daniel@zonque.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@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®