]> Gentwo Git Trees - linux/.git/commit
of: Add wrappers to match root node with OF device ID tables
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 12 Nov 2025 10:28:46 +0000 (11:28 +0100)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 27 Nov 2025 01:38:24 +0000 (19:38 -0600)
commit4a93adcbd201aad5ba607810cfe1b19d44e5d171
tree0aab3e49bdb3ecf087c19c4081ca04157beed7c3
parentdf2602e1c68af8ea5e6e91da9e48a4312b88e943
of: Add wrappers to match root node with OF device ID tables

Several drivers duplicate same code for getting reference to the root
node, matching it against 'struct of_device_id' table and getting out
the match data from the table entry.

There is a of_machine_compatible_match() wrapper but it takes array of
strings, which is not suitable for many drivers since they want the
driver data associated with each compatible.

Add two wrappers, similar to existing of_device_get_match_data():
1. of_machine_device_match() doing only matching against 'struct
   of_device_id' and returning bool.
2. of_machine_get_match_data() doing the matching and returning
   associated driver data for found compatible.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20251112-b4-of-match-matchine-data-v2-1-d46b72003fd6@linaro.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/base.c
include/linux/of.h