public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] of: Add and use of_machine_get_match() helper
@ 2026-03-02 16:29 Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 1/7] of: Add " Geert Uytterhoeven
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

	Hi all,

Currently, there are two helpers to match the root compatible value
against an of_device_id array:
  - of_machine_device_match() returns true if a match is found,
  - of_machine_get_match_data() returns the match data if a match is
    found.
However, there is no helper that returns the actual of_device_id
structure corresponding to the match, leading to code duplication in
various drivers.  Worse, with the plan to make of_root private[1], more
open-coded users may appear.

Hence this series adds a new helper of_machine_get_match(), which
returns the match entry, and converts several drivers to make use of it.
Note that the new wrapper comes at no cost (binary size-wise),
as the variant returning bool can be a trivial inline wrapper.

One could argue we don't even need the variant that returns bool,
as
    "if (of_machine_device_match(...))" and
    "if (of_machine_get_match(...))",
and
    "if (!of_machine_device_match(...))" and
    "if (!of_machine_get_match(...))"
are equivalent.

The return type only matters when assigning to or returning an explicit
type, like in drivers/soc/tegra/common.c:

    bool soc_is_tegra(void)
    {
	    return of_machine_device_match(tegra_machine_match);
    }

Only the Renesas driver patch was tested on actual hardware.

Thanks for your comments!

[1] "[PATCH v2 0/9] soc: remove direct accesses to of_root from
     drivers/soc/"
    https://lore.kernel.org/20260223-soc-of-root-v2-0-b45da45903c8@oss.qualcomm.com/

Geert Uytterhoeven (7):
  of: Add of_machine_get_match() helper
  of: Convert to of_machine_get_match()
  cpufreq: airoha: Convert to of_machine_get_match()
  cpufreq: qcom-nvmem: Convert to of_machine_get_match()
  cpufreq: ti-cpufreq: Convert to of_machine_get_match()
  soc: qcom: pd-mapper: Convert to of_machine_get_match()
  soc: renesas: Convert to of_machine_get_match()

 drivers/cpufreq/airoha-cpufreq.c     |  7 +------
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 16 ++--------------
 drivers/cpufreq/ti-cpufreq.c         | 12 +-----------
 drivers/of/base.c                    | 20 ++++++--------------
 drivers/soc/qcom/qcom_pd_mapper.c    |  8 +-------
 drivers/soc/renesas/renesas-soc.c    |  2 +-
 include/linux/of.h                   | 11 ++++++++---
 7 files changed, 20 insertions(+), 56 deletions(-)

-- 
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 1/7] of: Add of_machine_get_match() helper
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 2/7] of: Convert to of_machine_get_match() Geert Uytterhoeven
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Currently, there are two helpers to match the root compatible value
against an of_device_id array:
  - of_machine_device_match() returns true if a match is found,
  - of_machine_get_match_data() returns the match data if a match is
    found.
However, there is no helper that returns the actual of_device_id
structure corresponding to the match, leading to code duplication in
various drivers.

Fix this by reworking of_machine_device_match() to return the actual
match structure, and renaming it to of_machine_get_match().
Retain the old of_machine_device_match() functionality using a cheap
static inline wrapper around the new of_machine_get_match() helper.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/of/base.c  | 11 +++++------
 include/linux/of.h | 11 ++++++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 46ebd61655930857..3f061f10aff8fca9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -435,13 +435,12 @@ bool of_machine_compatible_match(const char *const *compats)
 EXPORT_SYMBOL(of_machine_compatible_match);
 
 /**
- * of_machine_device_match - Test root of device tree against a of_device_id array
+ * of_machine_get_match - Test root of device tree against an of_device_id array
  * @matches:	NULL terminated array of of_device_id match structures to search in
  *
- * Returns true if the root node has any of the given compatible values in its
- * compatible property.
+ * Returns matched entry or NULL
  */
-bool of_machine_device_match(const struct of_device_id *matches)
+const struct of_device_id *of_machine_get_match(const struct of_device_id *matches)
 {
 	struct device_node *root;
 	const struct of_device_id *match = NULL;
@@ -452,9 +451,9 @@ bool of_machine_device_match(const struct of_device_id *matches)
 		of_node_put(root);
 	}
 
-	return match != NULL;
+	return match;
 }
-EXPORT_SYMBOL(of_machine_device_match);
+EXPORT_SYMBOL(of_machine_get_match);
 
 /**
  * of_machine_get_match_data - Tell if root of device tree has a matching of_match structure
diff --git a/include/linux/of.h b/include/linux/of.h
index 5dc394e626a48952..c70f7b05c59bceda 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -410,7 +410,7 @@ extern int of_alias_get_id(const struct device_node *np, const char *stem);
 extern int of_alias_get_highest_id(const char *stem);
 
 bool of_machine_compatible_match(const char *const *compats);
-bool of_machine_device_match(const struct of_device_id *matches);
+const struct of_device_id *of_machine_get_match(const struct of_device_id *matches);
 const void *of_machine_get_match_data(const struct of_device_id *matches);
 
 /**
@@ -866,9 +866,9 @@ static inline bool of_machine_compatible_match(const char *const *compats)
 	return false;
 }
 
-static inline bool of_machine_device_match(const struct of_device_id *matches)
+static inline const struct of_device_id *of_machine_get_match(const struct of_device_id *matches)
 {
-	return false;
+	return NULL;
 }
 
 static inline const void *
@@ -976,6 +976,11 @@ static inline int of_numa_init(void)
 }
 #endif
 
+static inline bool of_machine_device_match(const struct of_device_id *matches)
+{
+	return of_machine_get_match(matches) != NULL;
+}
+
 static inline struct device_node *of_find_matching_node(
 	struct device_node *from,
 	const struct of_device_id *matches)
-- 
2.43.0


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

* [PATCH 2/7] of: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 1/7] of: Add " Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 3/7] cpufreq: airoha: " Geert Uytterhoeven
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/of/base.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3f061f10aff8fca9..39e751df9daf689f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -504,15 +504,8 @@ EXPORT_SYMBOL(of_machine_get_match);
 const void *of_machine_get_match_data(const struct of_device_id *matches)
 {
 	const struct of_device_id *match;
-	struct device_node *root;
-
-	root = of_find_node_by_path("/");
-	if (!root)
-		return NULL;
-
-	match = of_match_node(matches, root);
-	of_node_put(root);
 
+	match = of_machine_get_match(matches);
 	if (!match)
 		return NULL;
 
-- 
2.43.0


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

* [PATCH 3/7] cpufreq: airoha: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 1/7] of: Add " Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 2/7] of: Convert to of_machine_get_match() Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 4/7] cpufreq: qcom-nvmem: " Geert Uytterhoeven
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/cpufreq/airoha-cpufreq.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/cpufreq/airoha-cpufreq.c b/drivers/cpufreq/airoha-cpufreq.c
index b6b1cdc4d11d6962..3e7770860d13c8f4 100644
--- a/drivers/cpufreq/airoha-cpufreq.c
+++ b/drivers/cpufreq/airoha-cpufreq.c
@@ -115,15 +115,10 @@ MODULE_DEVICE_TABLE(of, airoha_cpufreq_match_list);
 
 static int __init airoha_cpufreq_init(void)
 {
-	struct device_node *np = of_find_node_by_path("/");
 	const struct of_device_id *match;
 	int ret;
 
-	if (!np)
-		return -ENODEV;
-
-	match = of_match_node(airoha_cpufreq_match_list, np);
-	of_node_put(np);
+	match = of_machine_get_match(airoha_cpufreq_match_list);
 	if (!match)
 		return -ENODEV;
 
-- 
2.43.0


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

* [PATCH 4/7] cpufreq: qcom-nvmem: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2026-03-02 16:29 ` [PATCH 3/7] cpufreq: airoha: " Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 5/7] cpufreq: ti-cpufreq: " Geert Uytterhoeven
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index b8081acba928f5a9..e6d28d162442a085 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -291,17 +291,9 @@ static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev,
 	ret = qcom_smem_get_soc_id(&msm_id);
 	if (ret == -ENODEV) {
 		const struct of_device_id *match;
-		struct device_node *root;
-
-		root = of_find_node_by_path("/");
-		if (!root) {
-			ret = -ENODEV;
-			goto exit;
-		}
 
 		/* Fallback to compatible match with no SMEM initialized */
-		match = of_match_node(qcom_cpufreq_ipq806x_match_list, root);
-		of_node_put(root);
+		match = of_machine_get_match(qcom_cpufreq_ipq806x_match_list);
 		if (!match) {
 			ret = -ENODEV;
 			goto exit;
@@ -647,14 +639,10 @@ MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list);
  */
 static int __init qcom_cpufreq_init(void)
 {
-	struct device_node *np __free(device_node) = of_find_node_by_path("/");
 	const struct of_device_id *match;
 	int ret;
 
-	if (!np)
-		return -ENODEV;
-
-	match = of_match_node(qcom_cpufreq_match_list, np);
+	match = of_machine_get_match(qcom_cpufreq_match_list);
 	if (!match)
 		return -ENODEV;
 
-- 
2.43.0


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

* [PATCH 5/7] cpufreq: ti-cpufreq: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2026-03-02 16:29 ` [PATCH 4/7] cpufreq: qcom-nvmem: " Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-02 16:29 ` [PATCH 6/7] soc: qcom: pd-mapper: " Geert Uytterhoeven
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/cpufreq/ti-cpufreq.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 3d1129aeed02b06f..a01abc1622eb712b 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -502,16 +502,6 @@ static const struct of_device_id ti_cpufreq_of_match[]  __maybe_unused = {
 	{},
 };
 
-static const struct of_device_id *ti_cpufreq_match_node(void)
-{
-	struct device_node *np __free(device_node) = of_find_node_by_path("/");
-	const struct of_device_id *match;
-
-	match = of_match_node(ti_cpufreq_of_match, np);
-
-	return match;
-}
-
 static int ti_cpufreq_probe(struct platform_device *pdev)
 {
 	u32 version[VERSION_COUNT];
@@ -596,7 +586,7 @@ static int __init ti_cpufreq_init(void)
 	const struct of_device_id *match;
 
 	/* Check to ensure we are on a compatible platform */
-	match = ti_cpufreq_match_node();
+	match = of_machine_get_match(ti_cpufreq_of_match);
 	if (match)
 		platform_device_register_data(NULL, "ti-cpufreq", -1, match,
 					      sizeof(*match));
-- 
2.43.0


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

* [PATCH 6/7] soc: qcom: pd-mapper: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2026-03-02 16:29 ` [PATCH 5/7] cpufreq: ti-cpufreq: " Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-03 10:07   ` Konrad Dybcio
  2026-03-19  3:36   ` Bjorn Andersson
  2026-03-02 16:29 ` [PATCH 7/7] soc: renesas: " Geert Uytterhoeven
  2026-03-03  4:31 ` [PATCH 0/7] of: Add and use of_machine_get_match() helper Viresh Kumar
  7 siblings, 2 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/soc/qcom/qcom_pd_mapper.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
index dc10bc859ff4170c..8a1a18f8c859496f 100644
--- a/drivers/soc/qcom/qcom_pd_mapper.c
+++ b/drivers/soc/qcom/qcom_pd_mapper.c
@@ -615,15 +615,9 @@ static struct qcom_pdm_data *qcom_pdm_start(void)
 	const struct qcom_pdm_domain_data * const *domains;
 	const struct of_device_id *match;
 	struct qcom_pdm_data *data;
-	struct device_node *root;
 	int ret, i;
 
-	root = of_find_node_by_path("/");
-	if (!root)
-		return ERR_PTR(-ENODEV);
-
-	match = of_match_node(qcom_pdm_domains, root);
-	of_node_put(root);
+	match = of_machine_get_match(qcom_pdm_domains);
 	if (!match) {
 		pr_notice("PDM: no support for the platform, userspace daemon might be required.\n");
 		return ERR_PTR(-ENODEV);
-- 
2.43.0


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

* [PATCH 7/7] soc: renesas: Convert to of_machine_get_match()
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2026-03-02 16:29 ` [PATCH 6/7] soc: qcom: pd-mapper: " Geert Uytterhoeven
@ 2026-03-02 16:29 ` Geert Uytterhoeven
  2026-03-13 21:59   ` Rob Herring
  2026-03-03  4:31 ` [PATCH 0/7] of: Add and use of_machine_get_match() helper Viresh Kumar
  7 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel, Geert Uytterhoeven

Use the of_machine_get_match() helper to avoid accessing of_root
directly, which is planned to become private.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is an alternative solution to "[PATCH v2 8/9] soc: renesas: don't
access of_root directly"
https://lore.kernel.org/20260223-soc-of-root-v2-8-b45da45903c8@oss.qualcomm.com
---
 drivers/soc/renesas/renesas-soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index f6c41892fbe549e8..bcba01acf283003d 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -488,7 +488,7 @@ static int __init renesas_soc_init(void)
 	const char *soc_id;
 	int ret;
 
-	match = of_match_node(renesas_socs, of_root);
+	match = of_machine_get_match(renesas_socs);
 	if (!match)
 		return -ENODEV;
 
-- 
2.43.0


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

* Re: [PATCH 0/7] of: Add and use of_machine_get_match() helper
  2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2026-03-02 16:29 ` [PATCH 7/7] soc: renesas: " Geert Uytterhoeven
@ 2026-03-03  4:31 ` Viresh Kumar
  7 siblings, 0 replies; 13+ messages in thread
From: Viresh Kumar @ 2026-03-03  4:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bartosz Golaszewski, Rob Herring, Saravana Kannan,
	Rafael J . Wysocki, Ilia Lin, Bjorn Andersson, Konrad Dybcio,
	Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel

On 02-03-26, 17:29, Geert Uytterhoeven wrote:
> Geert Uytterhoeven (7):
>   cpufreq: airoha: Convert to of_machine_get_match()
>   cpufreq: qcom-nvmem: Convert to of_machine_get_match()
>   cpufreq: ti-cpufreq: Convert to of_machine_get_match()

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* Re: [PATCH 6/7] soc: qcom: pd-mapper: Convert to of_machine_get_match()
  2026-03-02 16:29 ` [PATCH 6/7] soc: qcom: pd-mapper: " Geert Uytterhoeven
@ 2026-03-03 10:07   ` Konrad Dybcio
  2026-03-19  3:36   ` Bjorn Andersson
  1 sibling, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2026-03-03 10:07 UTC (permalink / raw)
  To: Geert Uytterhoeven, Bartosz Golaszewski, Rob Herring,
	Saravana Kannan
  Cc: Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Bjorn Andersson,
	Konrad Dybcio, Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel

On 3/2/26 5:29 PM, Geert Uytterhoeven wrote:
> Use the of_machine_get_match() helper instead of open-coding the same
> operation.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Compile-tested only.
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

* Re: [PATCH 7/7] soc: renesas: Convert to of_machine_get_match()
  2026-03-02 16:29 ` [PATCH 7/7] soc: renesas: " Geert Uytterhoeven
@ 2026-03-13 21:59   ` Rob Herring
  2026-03-25 16:35     ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2026-03-13 21:59 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bartosz Golaszewski, Saravana Kannan, Rafael J . Wysocki,
	Viresh Kumar, Ilia Lin, Bjorn Andersson, Konrad Dybcio,
	Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel

On Mon, Mar 02, 2026 at 05:29:11PM +0100, Geert Uytterhoeven wrote:
> Use the of_machine_get_match() helper to avoid accessing of_root
> directly, which is planned to become private.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This is an alternative solution to "[PATCH v2 8/9] soc: renesas: don't
> access of_root directly"
> https://lore.kernel.org/20260223-soc-of-root-v2-8-b45da45903c8@oss.qualcomm.com

Greg applied this, so you'll have to respin on top of that. Next cycle I 
guess. Unless you get him to revert it.

I'm applying the rest of the series.

Rob

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

* Re: [PATCH 6/7] soc: qcom: pd-mapper: Convert to of_machine_get_match()
  2026-03-02 16:29 ` [PATCH 6/7] soc: qcom: pd-mapper: " Geert Uytterhoeven
  2026-03-03 10:07   ` Konrad Dybcio
@ 2026-03-19  3:36   ` Bjorn Andersson
  1 sibling, 0 replies; 13+ messages in thread
From: Bjorn Andersson @ 2026-03-19  3:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bartosz Golaszewski, Rob Herring, Saravana Kannan,
	Rafael J . Wysocki, Viresh Kumar, Ilia Lin, Konrad Dybcio,
	Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel

On Mon, Mar 02, 2026 at 05:29:10PM +0100, Geert Uytterhoeven wrote:
> Use the of_machine_get_match() helper instead of open-coding the same
> operation.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Bjorn Andersson <andersson@kernel.org>

Regards,
Bjorn

> ---
> Compile-tested only.
> ---
>  drivers/soc/qcom/qcom_pd_mapper.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/soc/qcom/qcom_pd_mapper.c b/drivers/soc/qcom/qcom_pd_mapper.c
> index dc10bc859ff4170c..8a1a18f8c859496f 100644
> --- a/drivers/soc/qcom/qcom_pd_mapper.c
> +++ b/drivers/soc/qcom/qcom_pd_mapper.c
> @@ -615,15 +615,9 @@ static struct qcom_pdm_data *qcom_pdm_start(void)
>  	const struct qcom_pdm_domain_data * const *domains;
>  	const struct of_device_id *match;
>  	struct qcom_pdm_data *data;
> -	struct device_node *root;
>  	int ret, i;
>  
> -	root = of_find_node_by_path("/");
> -	if (!root)
> -		return ERR_PTR(-ENODEV);
> -
> -	match = of_match_node(qcom_pdm_domains, root);
> -	of_node_put(root);
> +	match = of_machine_get_match(qcom_pdm_domains);
>  	if (!match) {
>  		pr_notice("PDM: no support for the platform, userspace daemon might be required.\n");
>  		return ERR_PTR(-ENODEV);
> -- 
> 2.43.0
> 

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

* Re: [PATCH 7/7] soc: renesas: Convert to of_machine_get_match()
  2026-03-13 21:59   ` Rob Herring
@ 2026-03-25 16:35     ` Geert Uytterhoeven
  0 siblings, 0 replies; 13+ messages in thread
From: Geert Uytterhoeven @ 2026-03-25 16:35 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bartosz Golaszewski, Saravana Kannan, Rafael J . Wysocki,
	Viresh Kumar, Ilia Lin, Bjorn Andersson, Konrad Dybcio,
	Magnus Damm, devicetree, linux-pm, linux-arm-msm,
	linux-renesas-soc, linux-kernel

Hi Rob,

On Fri, 13 Mar 2026 at 22:59, Rob Herring <robh@kernel.org> wrote:
> On Mon, Mar 02, 2026 at 05:29:11PM +0100, Geert Uytterhoeven wrote:
> > Use the of_machine_get_match() helper to avoid accessing of_root
> > directly, which is planned to become private.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > This is an alternative solution to "[PATCH v2 8/9] soc: renesas: don't
> > access of_root directly"
> > https://lore.kernel.org/20260223-soc-of-root-v2-8-b45da45903c8@oss.qualcomm.com
>
> Greg applied this, so you'll have to respin on top of that. Next cycle I
> guess. Unless you get him to revert it.

That was my impression, too, but apparently he skipped that patch.
So you can still apply this patch, too.

> I'm applying the rest of the series.

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2026-03-25 16:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 16:29 [PATCH 0/7] of: Add and use of_machine_get_match() helper Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 1/7] of: Add " Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 2/7] of: Convert to of_machine_get_match() Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 3/7] cpufreq: airoha: " Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 4/7] cpufreq: qcom-nvmem: " Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 5/7] cpufreq: ti-cpufreq: " Geert Uytterhoeven
2026-03-02 16:29 ` [PATCH 6/7] soc: qcom: pd-mapper: " Geert Uytterhoeven
2026-03-03 10:07   ` Konrad Dybcio
2026-03-19  3:36   ` Bjorn Andersson
2026-03-02 16:29 ` [PATCH 7/7] soc: renesas: " Geert Uytterhoeven
2026-03-13 21:59   ` Rob Herring
2026-03-25 16:35     ` Geert Uytterhoeven
2026-03-03  4:31 ` [PATCH 0/7] of: Add and use of_machine_get_match() helper Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox