* [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks
@ 2024-05-28 0:14 Samuel Holland
2024-05-28 8:04 ` Russell King (Oracle)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Samuel Holland @ 2024-05-28 0:14 UTC (permalink / raw)
To: Stephen Boyd
Cc: Samuel Holland, Guenter Roeck, Russell King,
AngeloGioacchino Del Regno, Dinh Nguyen, Krzysztof Kozlowski,
Michael Turquette, Paul Walmsley, Rob Herring,
Russell King (Oracle), Yang Li, linux-clk, linux-kernel,
linux-riscv
These clkdevs were unnecessary, because systems using this driver always
look up clocks using the devicetree. And as Russell King points out[1],
since the provided device name was truncated, lookups via clkdev would
never match.
Recently, commit 8d532528ff6a ("clkdev: report over-sized strings when
creating clkdev entries") caused clkdev registration to fail due to the
truncation, and this now prevents the driver from probing. Fix the
driver by removing the clkdev registration.
Link: https://lore.kernel.org/linux-clk/ZkfYqj+OcAxd9O2t@shell.armlinux.org.uk/ [1]
Fixes: 30b8e27e3b58 ("clk: sifive: add a driver for the SiFive FU540 PRCI IP block")
Fixes: 8d532528ff6a ("clkdev: report over-sized strings when creating clkdev entries")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/linux-clk/7eda7621-0dde-4153-89e4-172e4c095d01@roeck-us.net/
Suggested-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---
This change fixes v6.10-rc1 boot on HiFive Unmatched.
drivers/clk/sifive/sifive-prci.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
index 25b8e1a80ddc..b32a59fe55e7 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -4,7 +4,6 @@
* Copyright (C) 2020 Zong Li
*/
-#include <linux/clkdev.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -537,13 +536,6 @@ static int __prci_register_clocks(struct device *dev, struct __prci_data *pd,
return r;
}
- r = clk_hw_register_clkdev(&pic->hw, pic->name, dev_name(dev));
- if (r) {
- dev_warn(dev, "Failed to register clkdev for %s: %d\n",
- init.name, r);
- return r;
- }
-
pd->hw_clks.hws[i] = &pic->hw;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks
2024-05-28 0:14 [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks Samuel Holland
@ 2024-05-28 8:04 ` Russell King (Oracle)
2024-05-28 8:17 ` Russell King (Oracle)
2024-05-29 20:53 ` Stephen Boyd
2 siblings, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 8:04 UTC (permalink / raw)
To: Samuel Holland
Cc: Stephen Boyd, Guenter Roeck, AngeloGioacchino Del Regno,
Dinh Nguyen, Krzysztof Kozlowski, Michael Turquette,
Paul Walmsley, Rob Herring, Yang Li, linux-clk, linux-kernel,
linux-riscv
On Mon, May 27, 2024 at 05:14:12PM -0700, Samuel Holland wrote:
> These clkdevs were unnecessary, because systems using this driver always
> look up clocks using the devicetree. And as Russell King points out[1],
> since the provided device name was truncated, lookups via clkdev would
> never match.
There is another reason they would never match - clkdev has always been
about matching the clock _consumer_ using the device name and connection
name to the producer. The device and connection name passed into clkdev
should always be the consumer (it's documented as such.)
Providing the producer device name to clkdev when registering an entry
will mean that clk_get(consumer_dev, consumer_name) will fail to find
the entry in clkdev's table, and thus fail to find the clock.
So, this code has been incorrect from the very start.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks
2024-05-28 0:14 [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks Samuel Holland
2024-05-28 8:04 ` Russell King (Oracle)
@ 2024-05-28 8:17 ` Russell King (Oracle)
2024-05-29 20:53 ` Stephen Boyd
2 siblings, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2024-05-28 8:17 UTC (permalink / raw)
To: Samuel Holland
Cc: Stephen Boyd, Guenter Roeck, AngeloGioacchino Del Regno,
Dinh Nguyen, Krzysztof Kozlowski, Michael Turquette,
Paul Walmsley, Rob Herring, Yang Li, linux-clk, linux-kernel,
linux-riscv
On Mon, May 27, 2024 at 05:14:12PM -0700, Samuel Holland wrote:
> These clkdevs were unnecessary, because systems using this driver always
> look up clocks using the devicetree. And as Russell King points out[1],
> since the provided device name was truncated, lookups via clkdev would
> never match.
>
> Recently, commit 8d532528ff6a ("clkdev: report over-sized strings when
> creating clkdev entries") caused clkdev registration to fail due to the
> truncation, and this now prevents the driver from probing. Fix the
> driver by removing the clkdev registration.
>
> Link: https://lore.kernel.org/linux-clk/ZkfYqj+OcAxd9O2t@shell.armlinux.org.uk/ [1]
> Fixes: 30b8e27e3b58 ("clk: sifive: add a driver for the SiFive FU540 PRCI IP block")
> Fixes: 8d532528ff6a ("clkdev: report over-sized strings when creating clkdev entries")
This doesn't really fix this commit, since if someone else is doing the
same thing, then they too may also fail to boot, so I'd suggest that
this Fixes tag is removed.
See https://lore.kernel.org/r/E1sBrzn-00E8GK-Ue@rmk-PC.armlinux.org.uk
for a fix that solves the issue introduced by that commit.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks
2024-05-28 0:14 [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks Samuel Holland
2024-05-28 8:04 ` Russell King (Oracle)
2024-05-28 8:17 ` Russell King (Oracle)
@ 2024-05-29 20:53 ` Stephen Boyd
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2024-05-29 20:53 UTC (permalink / raw)
To: Samuel Holland
Cc: Samuel Holland, Guenter Roeck, Russell King,
AngeloGioacchino Del Regno, Dinh Nguyen, Krzysztof Kozlowski,
Michael Turquette, Paul Walmsley, Rob Herring, Russell King,
Yang Li, linux-clk, linux-kernel, linux-riscv
Quoting Samuel Holland (2024-05-27 17:14:12)
> These clkdevs were unnecessary, because systems using this driver always
> look up clocks using the devicetree. And as Russell King points out[1],
> since the provided device name was truncated, lookups via clkdev would
> never match.
>
> Recently, commit 8d532528ff6a ("clkdev: report over-sized strings when
> creating clkdev entries") caused clkdev registration to fail due to the
> truncation, and this now prevents the driver from probing. Fix the
> driver by removing the clkdev registration.
>
> Link: https://lore.kernel.org/linux-clk/ZkfYqj+OcAxd9O2t@shell.armlinux.org.uk/ [1]
> Fixes: 30b8e27e3b58 ("clk: sifive: add a driver for the SiFive FU540 PRCI IP block")
> Fixes: 8d532528ff6a ("clkdev: report over-sized strings when creating clkdev entries")
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Closes: https://lore.kernel.org/linux-clk/7eda7621-0dde-4153-89e4-172e4c095d01@roeck-us.net/
> Suggested-by: Russell King <linux@armlinux.org.uk>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
> ---
Applied to clk-fixes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-29 20:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 0:14 [PATCH] clk: sifive: Do not register clkdevs for PRCI clocks Samuel Holland
2024-05-28 8:04 ` Russell King (Oracle)
2024-05-28 8:17 ` Russell King (Oracle)
2024-05-29 20:53 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox