]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
of: Add of_machine_get_match() helper
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 2 Mar 2026 16:29:05 +0000 (17:29 +0100)
committerRob Herring (Arm) <robh@kernel.org>
Fri, 13 Mar 2026 22:00:04 +0000 (17:00 -0500)
commit82b6c1b542ea0530318c6f2a880d884eb4dce49f
tree0b4ef9d8e5fd7068351d00bd5612692aca04d0ea
parentc1bf657164413426cb4d7d1231f8a6b949f08188
of: Add of_machine_get_match() helper

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>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/14e1c03d443b1a5f210609ec3a1ebbaeab8fb3d9.1772468323.git.geert+renesas@glider.be
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/base.c
include/linux/of.h