From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@kernel.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Ilia Lin <ilia.lin@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 0/7] of: Add and use of_machine_get_match() helper
Date: Mon, 2 Mar 2026 17:29:04 +0100 [thread overview]
Message-ID: <cover.1772468323.git.geert+renesas@glider.be> (raw)
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
next reply other threads:[~2026-03-02 16:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 16:29 Geert Uytterhoeven [this message]
2026-03-02 16:29 ` [PATCH 1/7] of: Add of_machine_get_match() helper 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
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=cover.1772468323.git.geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=devicetree@vger.kernel.org \
--cc=ilia.lin@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
--cc=viresh.kumar@linaro.org \
/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