Skip to content

Commit 57f77cb

Browse files
krzkrobherring
authored andcommitted
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>
1 parent 599ff56 commit 57f77cb

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

drivers/soc/qcom/ubwc_config.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,21 +277,15 @@ static const struct of_device_id qcom_ubwc_configs[] __maybe_unused = {
277277

278278
const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
279279
{
280-
const struct of_device_id *match;
281-
struct device_node *root;
280+
const struct qcom_ubwc_cfg_data *data;
282281

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) {
290284
pr_err("Couldn't find UBWC config data for this platform!\n");
291285
return ERR_PTR(-EINVAL);
292286
}
293287

294-
return match->data;
288+
return data;
295289
}
296290
EXPORT_SYMBOL_GPL(qcom_ubwc_config_get_data);
297291

0 commit comments

Comments
 (0)