From nobody Thu Oct 2 10:55:26 2025 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F37CE2F9DA5; Thu, 18 Sep 2025 10:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758192038; cv=none; b=oaft9mDl43oaqfP5Mk44oloqrwBGd6VvuVueiA7bwPA3wM25I/FuTYOhWGX6pG6MBthAFJHTLOFf4dFxvOl67QrvTI+dzL1NaNXKqG4tEPeJ3BKSlQO7/VC38J/ZEneZnazX1HmRya3TwhxIlnIRhX7OE3E7RS02PwqXo4S2XsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758192038; c=relaxed/simple; bh=wKTOuqBfnalEmfN7yoZWb6HUSWjmCULlR5vNporkClE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ARJ3UEkwCFth/WekLDSA3M9jcWSbodMajZ+eNUl097RDicERkq78GEo5N6xx7WNnPX+DZbENW7LE3J+7CLONvB431CYcCiR+eKLrLlwzaz9uSfZOu6IpZnSGxJ05A6tnXAGvrZt7aaNRzUlAZ/fwhqQtK7rYNgugAEXbr2xpFS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=qivI2scR; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="qivI2scR" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 511244E40D0C; Thu, 18 Sep 2025 10:40:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 265DF6062C; Thu, 18 Sep 2025 10:40:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9F59C102F1CE5; Thu, 18 Sep 2025 12:40:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1758192033; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=QBlfnPJwGIXoUklEq6xYhFHnSO32edjs9JLjQGY9LrA=; b=qivI2scRDBJFEK5DDAVU3ozIIkeDuNXhVlTKLUcJ9fxapRg9jbyFwiEHs3OnAyAcsYi1la 6HgZt/5okulZhrt4HLQO6WPUIe2BXCfpPxehscvg/c4B/78dZ4bFdkLSUUIbPQ1O1d68km Lqi7GRnCEy+QuMnmqO0bX4rpqwsYH3TTCAs2wmkWt+muSTezmGjGGVmX9+35v9XRABNJ4t 6zwhpSiX0okTPn3Ypeab3qTW1H3aXSkjfLVIbQkiGjWxHsZVMX4CEdxbZ1iZZko1veppXC +4Fv8J1bwkKgKzJz05dD7bsuHsy1G4ZdPGL10mMjHITlGJwL1V+P6tvuwvJG8Q== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Hoan Tran , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Serge Semin , Herve Codina Cc: Phil Edworthy , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v3 3/8] irqchip/ls-extirq: Use for_each_of_imap_item iterator Date: Thu, 18 Sep 2025 12:40:01 +0200 Message-ID: <20250918104009.94754-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250918104009.94754-1-herve.codina@bootlin.com> References: <20250918104009.94754-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The ls-extirq 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 ls-extirq driver to use the for_each_of_imap_item iterator instead of open code. Signed-off-by: Herve Codina (Schneider Electric) --- drivers/irqchip/irq-ls-extirq.c | 47 ++++++++++++--------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/drivers/irqchip/irq-ls-extirq.c b/drivers/irqchip/irq-ls-extir= q.c index 50a7b38381b9..ed8755777349 100644 --- a/drivers/irqchip/irq-ls-extirq.c +++ b/drivers/irqchip/irq-ls-extirq.c @@ -125,45 +125,32 @@ static const struct irq_domain_ops extirq_domain_ops = =3D { static int ls_extirq_parse_map(struct ls_extirq_data *priv, struct device_node *node) { - const __be32 *map; - u32 mapsize; + struct of_imap_parser imap_parser; + struct of_imap_item imap_item; int ret; =20 - map =3D of_get_property(node, "interrupt-map", &mapsize); - if (!map) - return -ENOENT; - if (mapsize % sizeof(*map)) - return -EINVAL; - mapsize /=3D sizeof(*map); + ret =3D of_imap_parser_init(&imap_parser, node, &imap_item); + if (ret) + return ret; =20 - while (mapsize) { + for_each_of_imap_item(&imap_parser, &imap_item) { struct device_node *ipar; - u32 hwirq, intsize, j; + u32 hwirq; + int i; =20 - if (mapsize < 3) - return -EINVAL; - hwirq =3D be32_to_cpup(map); - if (hwirq >=3D MAXIRQ) + hwirq =3D imap_item.child_imap[0]; + if (hwirq >=3D MAXIRQ) { + of_node_put(imap_item.parent_args.np); return -EINVAL; + } priv->nirq =3D max(priv->nirq, hwirq + 1); =20 - ipar =3D of_find_node_by_phandle(be32_to_cpup(map + 2)); - map +=3D 3; - mapsize -=3D 3; - if (!ipar) - return -EINVAL; - priv->map[hwirq].fwnode =3D &ipar->fwnode; - ret =3D of_property_read_u32(ipar, "#interrupt-cells", &intsize); - if (ret) - return ret; - - if (intsize > mapsize) - return -EINVAL; + ipar =3D of_node_get(imap_item.parent_args.np); + priv->map[hwirq].fwnode =3D of_fwnode_handle(ipar); =20 - priv->map[hwirq].param_count =3D intsize; - for (j =3D 0; j < intsize; ++j) - priv->map[hwirq].param[j] =3D be32_to_cpup(map++); - mapsize -=3D intsize; + priv->map[hwirq].param_count =3D imap_item.parent_args.args_count; + for (i =3D 0; i < priv->map[hwirq].param_count; i++) + priv->map[hwirq].param[i] =3D imap_item.parent_args.args[i]; } return 0; } --=20 2.51.0