Replace open-coded getting root OF node, matching against it and getting
the match data with new of_machine_get_match_data() helper.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20251112-b4-of-match-matchine-data-v2-10-d46b72003fd6@linaro.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
{
- const struct of_device_id *match;
- struct device_node *root;
+ const struct qcom_ubwc_cfg_data *data;
- root = of_find_node_by_path("/");
- if (!root)
- return ERR_PTR(-ENODEV);
-
- match = of_match_node(qcom_ubwc_configs, root);
- of_node_put(root);
- if (!match) {
+ data = of_machine_get_match_data(qcom_ubwc_configs);
+ if (!data) {
pr_err("Couldn't find UBWC config data for this platform!\n");
return ERR_PTR(-EINVAL);
}
- return match->data;
+ return data;
}
EXPORT_SYMBOL_GPL(qcom_ubwc_config_get_data);