linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix Arm Ltd board node name collisions
@ 2021-11-09 16:46 Rob Herring
  2021-11-09 16:46 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Rob Herring
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rob Herring @ 2021-11-09 16:46 UTC (permalink / raw)
  To: Linus Walleij, Stephen Boyd, Sudeep Holla
  Cc: devicetree, linux-arm-kernel, Guenter Roeck, Lorenzo Pieralisi,
	linux-clk, linux-kernel

The node name changes in commits 25b892b583cc ("ARM: dts: arm: Update 
register-bit-led nodes 'reg' and node names") and 2d3de197a818 ("ARM: 
dts: arm: Update ICST clock nodes 'reg' and node names") caused name 
collisions with the kernel's handling of ICST clock names and platform 
device names. This series fixes the kernel side to handle the DT 
changes.

This does break DT ABI compatibility which is partially mitigated if 
these changes are backported to stable. The alternative is reverting the 
referenced DT changes and coming up with different node names without 
unit-addresses. Ultimately, ABI issues are platform maintainers' 
decision, not mine.

Rob


Rob Herring (2):
  of: Support using 'mask' in making device bus id
  clk: versatile: clk-icst: Ensure clock names are unique

 drivers/clk/versatile/clk-icst.c |  6 ++++--
 drivers/of/platform.c            | 10 ++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] of: Support using 'mask' in making device bus id
  2021-11-09 16:46 [PATCH 0/2] Fix Arm Ltd board node name collisions Rob Herring
@ 2021-11-09 16:46 ` Rob Herring
  2021-11-09 22:20   ` 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:22 ` [PATCH 0/2] Fix Arm Ltd board node name collisions Linus Walleij
  2 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2021-11-09 16:46 UTC (permalink / raw)
  To: Linus Walleij, Stephen Boyd, Sudeep Holla
  Cc: devicetree, linux-arm-kernel, Guenter Roeck, Lorenzo Pieralisi,
	linux-clk, linux-kernel, stable, Frank Rowand

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique
  2021-11-09 16:46 [PATCH 0/2] Fix Arm Ltd board node name collisions Rob Herring
  2021-11-09 16:46 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Rob Herring
@ 2021-11-09 16:46 ` 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
  2 siblings, 2 replies; 7+ messages in thread
From: Rob Herring @ 2021-11-09 16:46 UTC (permalink / raw)
  To: Linus Walleij, Stephen Boyd, Sudeep Holla
  Cc: devicetree, linux-arm-kernel, Guenter Roeck, Lorenzo Pieralisi,
	linux-clk, linux-kernel, stable

Commit 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and
node names") moved to using generic node names. That results in trying
to register multiple clocks with the same name. Fix this by including
the unit-address in the clock name.

Fixes: 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names")
Cc: stable@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-clk@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
This should be applied to stable to minimize DT ABI breakage.
---
 drivers/clk/versatile/clk-icst.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index 77fd0ecaf155..d52f976dc875 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -484,7 +484,7 @@ static void __init of_syscon_icst_setup(struct device_node *np)
 	struct device_node *parent;
 	struct regmap *map;
 	struct clk_icst_desc icst_desc;
-	const char *name = np->name;
+	const char *name;
 	const char *parent_name;
 	struct clk *regclk;
 	enum icst_control_type ctype;
@@ -533,15 +533,17 @@ static void __init of_syscon_icst_setup(struct device_node *np)
 		icst_desc.params = &icst525_apcp_cm_params;
 		ctype = ICST_INTEGRATOR_CP_CM_MEM;
 	} else {
-		pr_err("unknown ICST clock %s\n", name);
+		pr_err("unknown ICST clock %pOF\n", np);
 		return;
 	}
 
 	/* Parent clock name is not the same as node parent */
 	parent_name = of_clk_get_parent_name(np, 0);
+	name = kasprintf(GFP_KERNEL, "%pOFP", np);
 
 	regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype);
 	if (IS_ERR(regclk)) {
+		kfree(name);
 		pr_err("error setting up syscon ICST clock %s\n", name);
 		return;
 	}
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] of: Support using 'mask' in making device bus id
  2021-11-09 16:46 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Rob Herring
@ 2021-11-09 22:20   ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2021-11-09 22:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Boyd, Sudeep Holla, devicetree, linux-arm-kernel,
	Guenter Roeck, Lorenzo Pieralisi, linux-clk, linux-kernel,
	stable, Frank Rowand

On Tue, Nov 9, 2021 at 5:46 PM Rob Herring <robh@kernel.org> wrote:

> 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>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2021-11-09 22:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Boyd, Sudeep Holla, devicetree, linux-arm-kernel,
	Guenter Roeck, Lorenzo Pieralisi, linux-clk, linux-kernel,
	stable

On Tue, Nov 9, 2021 at 5:46 PM Rob Herring <robh@kernel.org> wrote:

> Commit 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and
> node names") moved to using generic node names. That results in trying
> to register multiple clocks with the same name. Fix this by including
> the unit-address in the clock name.
>
> Fixes: 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names")
> Cc: stable@vger.kernel.org
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-clk@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Fix Arm Ltd board node name collisions
  2021-11-09 16:46 [PATCH 0/2] Fix Arm Ltd board node name collisions Rob Herring
  2021-11-09 16:46 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Rob Herring
  2021-11-09 16:46 ` [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique Rob Herring
@ 2021-11-09 22:22 ` Linus Walleij
  2 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2021-11-09 22:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Boyd, Sudeep Holla, devicetree, linux-arm-kernel,
	Guenter Roeck, Lorenzo Pieralisi, linux-clk, linux-kernel

On Tue, Nov 9, 2021 at 5:46 PM Rob Herring <robh@kernel.org> wrote:

> This does break DT ABI compatibility which is partially mitigated if
> these changes are backported to stable. The alternative is reverting the
> referenced DT changes and coming up with different node names without
> unit-addresses. Ultimately, ABI issues are platform maintainers'
> decision, not mine.

I don't mind breaking the ABI for these boards since everyone I
know rebuild the DT with the kernel and boot. I don't know if
other users flash it though, so check what Sudeep says.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2021-11-11  0:41 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring, Sudeep Holla
  Cc: devicetree, linux-arm-kernel, Guenter Roeck, Lorenzo Pieralisi,
	linux-clk, linux-kernel, stable

Quoting Rob Herring (2021-11-09 08:46:50)
> Commit 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and
> node names") moved to using generic node names. That results in trying
> to register multiple clocks with the same name. Fix this by including
> the unit-address in the clock name.
> 
> Fixes: 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names")
> Cc: stable@vger.kernel.org
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-clk@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-11  0:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 16:46 [PATCH 0/2] Fix Arm Ltd board node name collisions Rob Herring
2021-11-09 16:46 ` [PATCH 1/2] of: Support using 'mask' in making device bus id Rob Herring
2021-11-09 22:20   ` 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

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).