From nobody Sat Apr 4 01:50:36 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95C8E3803C5 for ; Sun, 22 Mar 2026 12:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774182278; cv=none; b=IwFTzf/pBco9HN4W5LY0TCYEP0sdwBtaXXTRTyAmVK6Q/3i/Z8V/7R7IL/+59ABXY9sFBIjC+NUUGAhCu4vFplZWnha17L6sPPglnVcnwO/foZ1OUt7h/vSHfRAO0MHNw2glL0M9eWX60zOHWxQNcj4clYef4gMuLZ0RCG6ppag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774182278; c=relaxed/simple; bh=jASfw8kdvkhMmRdlkZJdcEhZhf/cDrLIXPMn03ZcID4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AGiwe1nyP5QTNAGdaDfu9c+F1DRkyrB3tvK9TnJ3EXfAZdW1chxj6cas6cVdr4bcytx+Wq4yyd8TUUnKkJMb73y83eVnDZDlEK+a4FOloicxOL2EtutPfulqm1/daqawzAin75nLOrfulJCpB77+tb+k8kgnj+dgVAiy47/Vov8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d3RaAfoF; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d3RaAfoF" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-43b41b545d9so4068001f8f.2 for ; Sun, 22 Mar 2026 05:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774182274; x=1774787074; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WTOjP4wKgm+X9lCwgxDRiFdjvNAMY5QZsLvZtT22qWI=; b=d3RaAfoF6GJXhcObUNafeCIFzycM061/BVKzL2g5gZaWIzFzcKX8GedjECsgkvFzZI jCFzIWf7CxcbLlJFasTCo2ldTOMLBMR9fboSzc9aIS+0aVzM23pv1DNDECoPXs658AV5 maLZqXGyy5Vsm1PwpXU+ReB/th13L2ksLFjfpdxh7HXwYPcvGJx32tYkxIRSZB9XPEpR dwkEQ0J9tE0ISJl/c+Zw8u7aEKXk1UcbBWe9+1ExPQavBoj8fEwJL1YC/GLDIzwpioVO C3dU8y2qZJktxrP8fLIbto49mGGRkrXQwottGTa1/HYr4jEkdaOp4od3Gk2Ke3QBe3H5 iJWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774182274; x=1774787074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WTOjP4wKgm+X9lCwgxDRiFdjvNAMY5QZsLvZtT22qWI=; b=e0c/rptMndc0udUA4Inu1pP5zKbcQQS3WIiB9Ajn0AxaKPuLyhteXIQUQOwCJ5Mf/V LwIKG5527ZG4cLA4fubyvRquiizD6oN2lUhJaREJtnTkiyPZbPK83rT2xVVeI8VrVMdx o7qQXrFIewys2/t4vvdglz4tzyZd+bbKVX2jX8umNxmM/4wekIzqCtQXeyv7TMrM9sy3 lL8NilBbv/FcifogThYD4W2rwDZYIe/o33eeyie28CCEhn3Ndjhm01AiNHCRGK4NVjwS 02ZyIrp5sJwGG1AbQXkCD90ruQpnC9MaEvl2oUus0wJiaZZ/z7hwT5s3nr51zIqAaL/F F3Eg== X-Forwarded-Encrypted: i=1; AJvYcCWGwq9JSMe1qnbQu0s2WTPuNUOrakhpFY/C5tu0+nzq6jPSuJlxciwJKevhsL40KxSkA/y6U9rKgIKl82s=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7NKFQIGUdJgUCwfu4SkmesfUG/XJubnDd2jq+wolL6vhB944x MxTtFihpi4GEFhfFPRM/9OQWcGC6KcfcW+ZiXswpcAZ+BHQBd67UJoB2 X-Gm-Gg: ATEYQzz5uydT8FSwDpo3N5cnEbZpYc6vTn0eZIt9TLH3sDjb/22w3XjaI9pDARhUb6n 8bJVMsoH0A1LpTzderu6dAmWbiS2yQfo2Wv4M0q1qYzoFPsdPJ3CucsCs1MZdi9ilESdxDasYpe tfRwqkdcjbJsoSb4fYWogNwvaeKIH2ithPao+KsYZljiNZTqimNf/8ld1DLsw2EE4dy7kANdmbM TlGRDfFdcQ+vqVpRkaWtqE9G7Pu+s8DyOfL+R+pdV4NQ5AgGzawNw6wao2SvGwj41kloIscS7KY uy2f13kqBy3Xzc/J9lUn6aROHxc6Mc+yPTUNJ5o0BFxnYmECaxhST2zxVwzz7WVOb/AF+WMY/Sn LTH8GuQoK2B06x1ofBeMsvN+yrmKoxIZZUqhARu4onZ3/d7ST57piWr8YYIHpCyHnY7c20J3co6 X4RqLTz4LKGCAOk6wSuAWZp4/HS7VHIRa0wZlaz98/x3z2dd5srz/he0oSAPQ= X-Received: by 2002:a05:6000:4287:b0:439:b1d8:6091 with SMTP id ffacd0b85a97d-43b64234854mr14039364f8f.1.1774182274324; Sun, 22 Mar 2026 05:24:34 -0700 (PDT) Received: from localhost.localdomain ([2a00:23c4:a758:8a01:1bdc:7f84:18bc:1e56]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b64703343sm21072695f8f.19.2026.03.22.05.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2026 05:24:33 -0700 (PDT) From: Biju X-Google-Original-From: Biju To: Thomas Gleixner Cc: Biju Das , linux-kernel@vger.kernel.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH v6 11/15] irqchip/renesas-rzg2l: Drop IRQC_NUM_IRQ macro Date: Sun, 22 Mar 2026 12:23:54 +0000 Message-ID: <20260322122421.132474-12-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260322122421.132474-1-biju.das.jz@bp.renesas.com> References: <20260322122421.132474-1-biju.das.jz@bp.renesas.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 Content-Type: text/plain; charset="utf-8" From: Biju Das The total number of interrupts in RZ/G2L and RZ/G3L SoC are different. Introduce struct rzg2l_hw_info to handle the hardware differences and replace the macro IRQC_NUM_IRQ with num_irq variable in struct rzg2l_hw_info. Signed-off-by: Biju Das --- v5->v6: * No change. v4->v5: * Dropped the hw_irq range check involving info.num_irq v3->v4: * Updated commit description IRQs->interrupts * Replaced the variable type for num_irq in struct rzg2l_hw_info from u8->unsigned int * Replaced the pointer variable info from irqc_priv and instead embed a struct hwinfo into irqc_priv and copy the data into it at probe time. * Replaced the check 'hwirq > (priv->info->num_irq - 1)' with hwirq >=3D priv->info.num_irq v2->v3: * No change v1->v2: * No change --- drivers/irqchip/irq-renesas-rzg2l.c | 34 ++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-rene= sas-rzg2l.c index cf0d45c40083..5a21bca91e4e 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -24,7 +24,6 @@ #define IRQC_IRQ_COUNT 8 #define IRQC_TINT_START (IRQC_IRQ_START + IRQC_IRQ_COUNT) #define IRQC_TINT_COUNT 32 -#define IRQC_NUM_IRQ (IRQC_TINT_START + IRQC_TINT_COUNT) =20 #define ISCR 0x10 #define IITSR 0x14 @@ -68,6 +67,14 @@ struct rzg2l_irqc_reg_cache { u32 titsr[2]; }; =20 +/** + * struct rzg2l_hw_info - Interrupt Control Unit controller hardware info = structure. + * @num_irq: Total Number of interrupts + */ +struct rzg2l_hw_info { + unsigned int num_irq; +}; + /** * struct rzg2l_irqc_priv - IRQ controller private data structure * @base: Controller's base address @@ -75,6 +82,7 @@ struct rzg2l_irqc_reg_cache { * @tint_chip: Pointer to struct irq_chip for tint * @fwspec: IRQ firmware specific data * @lock: Lock to serialize access to hardware registers + * @info: Hardware specific data * @cache: Registers cache for suspend/resume */ static struct rzg2l_irqc_priv { @@ -83,6 +91,7 @@ static struct rzg2l_irqc_priv { const struct irq_chip *tint_chip; struct irq_fwspec *fwspec; raw_spinlock_t lock; + struct rzg2l_hw_info info; struct rzg2l_irqc_reg_cache cache; } *rzg2l_irqc_data; =20 @@ -573,7 +582,7 @@ static int rzg2l_irqc_alloc(struct irq_domain *domain, = unsigned int virq, chip =3D priv->irq_chip; } =20 - if (hwirq > (IRQC_NUM_IRQ - 1)) + if (hwirq >=3D priv->info.num_irq) return -EINVAL; =20 ret =3D irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, (void *)= (uintptr_t)tint); @@ -596,7 +605,7 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irq= c_priv *priv, unsigned int i; int ret; =20 - for (i =3D 0; i < IRQC_NUM_IRQ; i++) { + for (i =3D 0; i < priv->info.num_irq; i++) { ret =3D of_irq_parse_one(np, i, &map); if (ret) return ret; @@ -609,7 +618,8 @@ static int rzg2l_irqc_parse_interrupts(struct rzg2l_irq= c_priv *priv, =20 static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct de= vice_node *parent, const struct irq_chip *irq_chip, - const struct irq_chip *tint_chip) + const struct irq_chip *tint_chip, + const struct rzg2l_hw_info info) { struct irq_domain *irq_domain, *parent_domain; struct device_node *node =3D pdev->dev.of_node; @@ -632,7 +642,9 @@ static int rzg2l_irqc_common_probe(struct platform_devi= ce *pdev, struct device_n if (IS_ERR(rzg2l_irqc_data->base)) return PTR_ERR(rzg2l_irqc_data->base); =20 - rzg2l_irqc_data->fwspec =3D devm_kcalloc(&pdev->dev, IRQC_NUM_IRQ, + rzg2l_irqc_data->info =3D info; + + rzg2l_irqc_data->fwspec =3D devm_kcalloc(&pdev->dev, info.num_irq, sizeof(*rzg2l_irqc_data->fwspec), GFP_KERNEL); if (!rzg2l_irqc_data->fwspec) return -ENOMEM; @@ -657,7 +669,7 @@ static int rzg2l_irqc_common_probe(struct platform_devi= ce *pdev, struct device_n =20 raw_spin_lock_init(&rzg2l_irqc_data->lock); =20 - irq_domain =3D irq_domain_create_hierarchy(parent_domain, 0, IRQC_NUM_IRQ= , dev_fwnode(dev), + irq_domain =3D irq_domain_create_hierarchy(parent_domain, 0, info.num_irq= , dev_fwnode(dev), &rzg2l_irqc_domain_ops, rzg2l_irqc_data); if (!irq_domain) { pm_runtime_put(dev); @@ -669,14 +681,20 @@ static int rzg2l_irqc_common_probe(struct platform_de= vice *pdev, struct device_n return 0; } =20 +static const struct rzg2l_hw_info rzg2l_hw_params =3D { + .num_irq =3D IRQC_IRQ_START + IRQC_IRQ_COUNT + IRQC_TINT_COUNT, +}; + static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_no= de *parent) { - return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_irq_chip, &rzg2l= _irqc_tint_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzg2l_irqc_irq_chip, &rzg2l= _irqc_tint_chip, + rzg2l_hw_params); } =20 static int rzfive_irqc_probe(struct platform_device *pdev, struct device_n= ode *parent) { - return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_irq_chip, &rzfi= ve_irqc_tint_chip); + return rzg2l_irqc_common_probe(pdev, parent, &rzfive_irqc_irq_chip, &rzfi= ve_irqc_tint_chip, + rzg2l_hw_params); } =20 IRQCHIP_PLATFORM_DRIVER_BEGIN(rzg2l_irqc) --=20 2.43.0