soc: qcom: ubwc: Simplify with of_machine_get_match_data()

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>
This commit is contained in:
Krzysztof Kozlowski 2025-11-12 11:28:55 +01:00 committed by Rob Herring (Arm)
parent 599ff56eec
commit 57f77cb75b
1 changed files with 4 additions and 10 deletions

View File

@ -277,21 +277,15 @@ static const struct of_device_id qcom_ubwc_configs[] __maybe_unused = {
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);