Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Kozlowski and committed by
Rob Herring (Arm)
57f77cb7 599ff56e

+4 -10
+4 -10
drivers/soc/qcom/ubwc_config.c
··· 277 277 278 278 const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void) 279 279 { 280 - const struct of_device_id *match; 281 - struct device_node *root; 280 + const struct qcom_ubwc_cfg_data *data; 282 281 283 - root = of_find_node_by_path("/"); 284 - if (!root) 285 - return ERR_PTR(-ENODEV); 286 - 287 - match = of_match_node(qcom_ubwc_configs, root); 288 - of_node_put(root); 289 - if (!match) { 282 + data = of_machine_get_match_data(qcom_ubwc_configs); 283 + if (!data) { 290 284 pr_err("Couldn't find UBWC config data for this platform!\n"); 291 285 return ERR_PTR(-EINVAL); 292 286 } 293 287 294 - return match->data; 288 + return data; 295 289 } 296 290 EXPORT_SYMBOL_GPL(qcom_ubwc_config_get_data); 297 291