Commit 26ea8511 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Philipp Zabel

of: Add of_phandle_args_equal() helper

Add a helper comparing two "struct of_phandle_args" to avoid
reinventing the wheel.
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240129115216.96479-2-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent a6166a4d
......@@ -1065,6 +1065,22 @@ static inline int of_parse_phandle_with_optional_args(const struct device_node *
0, index, out_args);
}
/**
* of_phandle_args_equal() - Compare two of_phandle_args
* @a1: First of_phandle_args to compare
* @a2: Second of_phandle_args to compare
*
* Return: True if a1 and a2 are the same (same node pointer, same phandle
* args), false otherwise.
*/
static inline bool of_phandle_args_equal(const struct of_phandle_args *a1,
const struct of_phandle_args *a2)
{
return a1->np == a2->np &&
a1->args_count == a2->args_count &&
!memcmp(a1->args, a2->args, sizeof(a1->args[0]) * a1->args_count);
}
/**
* of_property_count_u8_elems - Count the number of u8 elements in a property
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment