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

soc: fsl: cpm1: qmc: Introduce qmc_chan_count_phandles()

No function in the QMC API is available to get the number of phandles
present in a phandle list.

Fill this lack introducing qmc_chan_count_phandles().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-9-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Herve Codina and committed by
Mark Brown
af8432b2 37797c60

+15
+13
drivers/soc/fsl/qe/qmc.c
··· 1777 1777 return qmc_chan; 1778 1778 } 1779 1779 1780 + int qmc_chan_count_phandles(struct device_node *np, const char *phandles_name) 1781 + { 1782 + int count; 1783 + 1784 + /* phandles are fixed args phandles with one arg */ 1785 + count = of_count_phandle_with_args(np, phandles_name, NULL); 1786 + if (count < 0) 1787 + return count; 1788 + 1789 + return count / 2; 1790 + } 1791 + EXPORT_SYMBOL(qmc_chan_count_phandles); 1792 + 1780 1793 struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np, 1781 1794 const char *phandles_name, 1782 1795 int index)
+2
include/soc/fsl/qe/qmc.h
··· 16 16 struct device; 17 17 struct qmc_chan; 18 18 19 + int qmc_chan_count_phandles(struct device_node *np, const char *phandles_name); 20 + 19 21 struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np, 20 22 const char *phandles_name, 21 23 int index);