Skip to content

Commit af8432b

Browse files
hcodinabroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 37797c6 commit af8432b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/soc/fsl/qe/qmc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,19 @@ static struct qmc_chan *qmc_chan_get_from_qmc(struct device_node *qmc_np, unsign
17771777
return qmc_chan;
17781778
}
17791779

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+
17801793
struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np,
17811794
const char *phandles_name,
17821795
int index)

include/soc/fsl/qe/qmc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct device_node;
1616
struct device;
1717
struct qmc_chan;
1818

19+
int qmc_chan_count_phandles(struct device_node *np, const char *phandles_name);
20+
1921
struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np,
2022
const char *phandles_name,
2123
int index);

0 commit comments

Comments
 (0)