mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clkdev: Improve clock discovery with clk_find()
@ 2026-11-03  8:49 Paul Cercueil
  2026-11-16 13:56 ` Paul Cercueil
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Cercueil @ 2026-11-03  8:49 UTC (permalink / raw)
  To: Russell King
  Cc: linux-arm-kernel, linux-kernel, Thomas Petazzoni, Paul Cercueil

With a setup where a clock provider registers a clock with a device name
"mydev" and a clock name "myclk", calling clk_find("mydev", NULL) would
not actually return any match.

Update the code so that we can support this while maintaining the
existing behaviour:

- clk_find("dev", "con") matches in order of priority ("dev", "con"),
  ("dev", *) and (*, "con");
- clk_find(NULL, "con") matches (*, "con");
- clk_find("dev", NULL) matches the first case of ("dev", *).
  Note that in that case we don't handle wildcards for the device name
  or it would end up matching everything.

Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
 drivers/clk/clkdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 919fc680ae4d..ee6c0afd6ec0 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -53,7 +53,9 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
 			match += 2;
 		}
 		if (p->con_id) {
-			if (!con_id || strcmp(p->con_id, con_id))
+			if (!con_id && !p->dev_id)
+				continue;
+			if (con_id && strcmp(p->con_id, con_id))
 				continue;
 			match += 1;
 		}
-- 
2.47.3


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

* Re: [PATCH] clkdev: Improve clock discovery with clk_find()
  2026-11-03  8:49 [PATCH] clkdev: Improve clock discovery with clk_find() Paul Cercueil
@ 2026-11-16 13:56 ` Paul Cercueil
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Cercueil @ 2026-11-16 13:56 UTC (permalink / raw)
  To: Russell King; +Cc: linux-arm-kernel, linux-kernel, Thomas Petazzoni

Hi Russell,

FYI I merged this patch into another patchset (of which you're in Cc)
called "ACPI: platform: ACPI 6.5 fixed clock support":
https://lore.kernel.org/linux-acpi/20261116135217.37038-1-paul.cercueil@bootlin.com/T/

So that you also get the context about why it's needed.

Cheers,
-Paul

Le mardi 03 novembre 2026 à 09:49 +0100, Paul Cercueil a écrit :
> With a setup where a clock provider registers a clock with a device name
> "mydev" and a clock name "myclk", calling clk_find("mydev", NULL) would
> not actually return any match.
> 
> Update the code so that we can support this while maintaining the
> existing behaviour:
> 
> - clk_find("dev", "con") matches in order of priority ("dev", "con"),
>   ("dev", *) and (*, "con");
> - clk_find(NULL, "con") matches (*, "con");
> - clk_find("dev", NULL) matches the first case of ("dev", *).
>   Note that in that case we don't handle wildcards for the device name
>   or it would end up matching everything.
> 
> Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
> ---
>  drivers/clk/clkdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 919fc680ae4d..ee6c0afd6ec0 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -53,7 +53,9 @@ static struct clk_lookup *clk_find(const char *dev_id, const
> char *con_id)
>  			match += 2;
>  		}
>  		if (p->con_id) {
> -			if (!con_id || strcmp(p->con_id, con_id))
> +			if (!con_id && !p->dev_id)
> +				continue;
> +			if (con_id && strcmp(p->con_id, con_id))
>  				continue;
>  			match += 1;
>  		}

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

end of thread, other threads:[~2026-11-16 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  8:49 [PATCH] clkdev: Improve clock discovery with clk_find() Paul Cercueil
2026-11-16 13:56 ` Paul Cercueil

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®