mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
irqchip/renesas-rza1: Use for_each_of_imap_item iterator
The renesas-rza1 driver parses the interrupt-map property. It does it using open code. Recently for_each_of_imap_item iterator has been introduce to help drivers in this parsing. Convert the renesas-rza1 driver to use the for_each_of_imap_item iterator instead of open code. Signed-off-by: Herve Codina (Schneider Electric) <herve.codina@bootlin.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260114093938.1089936-5-herve.codina@bootlin.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
This commit is contained in:
parent
3ac6dfe3d7
commit
94ed03a005
1 changed files with 16 additions and 27 deletions
|
|
@ -142,47 +142,36 @@ static const struct irq_domain_ops rza1_irqc_domain_ops = {
|
|||
static int rza1_irqc_parse_map(struct rza1_irqc_priv *priv,
|
||||
struct device_node *gic_node)
|
||||
{
|
||||
struct of_imap_parser imap_parser;
|
||||
struct device *dev = priv->dev;
|
||||
unsigned int imaplen, i, j;
|
||||
struct of_imap_item imap_item;
|
||||
struct device_node *ipar;
|
||||
const __be32 *imap;
|
||||
u32 intsize;
|
||||
unsigned int j;
|
||||
u32 i = 0;
|
||||
int ret;
|
||||
|
||||
imap = of_get_property(dev->of_node, "interrupt-map", &imaplen);
|
||||
if (!imap)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < IRQC_NUM_IRQ; i++) {
|
||||
if (imaplen < 3)
|
||||
return -EINVAL;
|
||||
ret = of_imap_parser_init(&imap_parser, dev->of_node, &imap_item);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for_each_of_imap_item(&imap_parser, &imap_item) {
|
||||
/* Check interrupt number, ignore sense */
|
||||
if (be32_to_cpup(imap) != i)
|
||||
if (imap_item.child_imap[0] != i) {
|
||||
of_node_put(imap_item.parent_args.np);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ipar = of_find_node_by_phandle(be32_to_cpup(imap + 2));
|
||||
ipar = imap_item.parent_args.np;
|
||||
if (ipar != gic_node) {
|
||||
of_node_put(ipar);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
imap += 3;
|
||||
imaplen -= 3;
|
||||
priv->map[i].args_count = imap_item.parent_args.args_count;
|
||||
for (j = 0; j < priv->map[i].args_count; j++)
|
||||
priv->map[i].args[j] = imap_item.parent_args.args[j];
|
||||
|
||||
ret = of_property_read_u32(ipar, "#interrupt-cells", &intsize);
|
||||
of_node_put(ipar);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (imaplen < intsize)
|
||||
return -EINVAL;
|
||||
|
||||
priv->map[i].args_count = intsize;
|
||||
for (j = 0; j < intsize; j++)
|
||||
priv->map[i].args[j] = be32_to_cpup(imap++);
|
||||
|
||||
imaplen -= intsize;
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue