icc-common.c 764 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2022 Linaro Ltd.
  4. */
  5. #include <linux/of.h>
  6. #include <linux/slab.h>
  7. #include <linux/module.h>
  8. #include "icc-common.h"
  9. struct icc_node_data *qcom_icc_xlate_extended(struct of_phandle_args *spec, void *data)
  10. {
  11. struct icc_node_data *ndata;
  12. struct icc_node *node;
  13. node = of_icc_xlate_onecell(spec, data);
  14. if (IS_ERR(node))
  15. return ERR_CAST(node);
  16. ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
  17. if (!ndata)
  18. return ERR_PTR(-ENOMEM);
  19. ndata->node = node;
  20. if (spec->args_count == 2)
  21. ndata->tag = spec->args[1];
  22. if (spec->args_count > 2)
  23. pr_warn("%pOF: Too many arguments, path tag is not parsed\n", spec->np);
  24. return ndata;
  25. }
  26. EXPORT_SYMBOL_GPL(qcom_icc_xlate_extended);
  27. MODULE_LICENSE("GPL");