From: Rob Herring <robh@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
Stephen Boyd <sboyd@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Guenter Roeck <linux@roeck-us.net>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Frank Rowand <frowand.list@gmail.com>
Subject: [PATCH 1/2] of: Support using 'mask' in making device bus id
Date: Tue, 9 Nov 2021 10:46:49 -0600 [thread overview]
Message-ID: <20211109164650.2233507-2-robh@kernel.org> (raw)
In-Reply-To: <20211109164650.2233507-1-robh@kernel.org>
Commit 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes
'reg' and node names") added a 'reg' property to nodes. This change has
the side effect of changing how the kernel generates the device name.
The assumption was a translatable 'reg' address is unique. However, in
the case of the register-bit-led binding (and a few others) that is not
the case. The 'mask' property must also be used in this case to make a
unique device name.
Fixes: 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
This should be applied to stable to minimize DT ABI breakage.
---
drivers/of/platform.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 07813fb1ef37..b3faf89744aa 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -76,6 +76,7 @@ static void of_device_make_bus_id(struct device *dev)
struct device_node *node = dev->of_node;
const __be32 *reg;
u64 addr;
+ u32 mask;
/* Construct the name, using parent nodes if necessary to ensure uniqueness */
while (node->parent) {
@@ -85,8 +86,13 @@ static void of_device_make_bus_id(struct device *dev)
*/
reg = of_get_property(node, "reg", NULL);
if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) {
- dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn",
- addr, node, dev_name(dev));
+ if (!of_property_read_u32(node, "mask", &mask))
+ dev_set_name(dev, dev_name(dev) ? "%llx.%x.%pOFn:%s" : "%llx.%x.%pOFn",
+ addr, ffs(mask) - 1, node, dev_name(dev));
+
+ else
+ dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn",
+ addr, node, dev_name(dev));
return;
}
--
2.32.0
next prev parent reply other threads:[~2021-11-09 16:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 16:46 [PATCH 0/2] Fix Arm Ltd board node name collisions Rob Herring
2021-11-09 16:46 ` Rob Herring [this message]
2021-11-09 22:20 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Linus Walleij
2021-11-09 16:46 ` [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique Rob Herring
2021-11-09 22:21 ` Linus Walleij
2021-11-11 0:41 ` Stephen Boyd
2021-11-09 22:22 ` [PATCH 0/2] Fix Arm Ltd board node name collisions Linus Walleij
-- strict thread matches above, loose matches on Subject: below --
2021-11-09 19:43 [PATCH 1/2] of: Support using 'mask' in making device bus id Guenter Roeck
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=20211109164650.2233507-2-robh@kernel.org \
--to=robh@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lorenzo.pieralisi@arm.com \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.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).