From nobody Sat Apr 4 01:51:13 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 C8866381B08 for ; Sun, 22 Mar 2026 12:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774182275; cv=none; b=Vtqef1Xiv15MAHO2edHWIS7Oyh84x53jDsfKAca4JL6VaGWWbr+SDPpxyQtuK0uc2swFHG3F9v11XhMBMG9aZChZAKep22IB4GYfLQSXk4HIidNSLHMEUhjGVGZBvHwnXtakOlTQ7HLi2fuXZ+LSHav+sjqdq9lo1F80odCs2bA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774182275; c=relaxed/simple; bh=vImPVu8izjNjWfSz3Eb23R6Sm8FThD2KV1KdyOIKvFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X27s8CRhGnklK8Cji5LAjaGcUW50VjRXfwX6cG+hHTz6D1KtuHC5ReoDya/BjKZ3GPBwdyKupHvdyXZkaMaD+a6aXLODsdACcNG8qqA0bEC3dOAJtfB+IUWzUXrwL5wSeHVCf/MouPQy8bu29rHdBcWRH8mcjZPAbDAv4uKsFGw= 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=Qpnz0nWa; arc=none smtp.client-ip=209.85.128.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="Qpnz0nWa" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-483487335c2so25287185e9.2 for ; Sun, 22 Mar 2026 05:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774182272; x=1774787072; 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=g78JyQIQc2fWjXTf3WwNwwJAwJHHc4x9tnvt/78e98A=; b=Qpnz0nWaJuI9E0XSLazzTyHZHJkGTDgnHkFpBNVeSNIxjuRdFfH8bMj5L7F64TFQLl QA6hiOaDXbggOuQP/dAqHk6VShT636yPSXwqmgycPsW7GQqvcrYdiBtP97AedpfJ8qA9 P/rcu8SxHqmXysxx6PVW6ww91n1/AdzinqtbXj1XvkAHJ7yQUv8vgByvXMoLPE1mliV/ W8ELx8P4d7RDCqwt7i3iLJ5NFqoVE9VcU68KqPVU8jCHx829o58IwmSCDOArUzDAWnKE fuhQMNE05vTTaQiIv2xUsyMnN07dBsPY9WzvJlXpOy9aeNwDgIHbExLezz2mQYZMlhqx 4LVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774182272; x=1774787072; 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=g78JyQIQc2fWjXTf3WwNwwJAwJHHc4x9tnvt/78e98A=; b=TEC8FcHTX4Pam7fg6dEcp7662STFRbWy8vRdXqf2ecdbg3dMKeSFY0pMbUf//Gxod5 Qt5rdH5UZWy9vZMVxHNTQNVVpYg5feUuPktMnJmmH7Z1lqC6OOOr+iGs7OQd/eGFLAyf IDFCkGoADT4DBVPdI/p+1ov6OOxZzW8MeUUhDL6nq+EtURlzKTE/PoVnQ5mDEdRS9l23 uX2B7oAkIpaAL+lXAdRM8BuEA5REJUu0rBzklSxz/gH2VKpDjzce4JegFL2QgJda+HJW 7eo0InBVLNgeq6ekTVwPrOgDUbWQePBLxJZI0cKm/e3mf2QlL9J38LcEukwTvFtazElC 25mw== X-Forwarded-Encrypted: i=1; AJvYcCUF7DnFDUtHtQL6sy8qjCEF7splXT3ASDX6zzQBoo2QD85zbU5ZdaO6dzkoUx6MCgCT2wcLq1SqKCHkR0Q=@vger.kernel.org X-Gm-Message-State: AOJu0YyS/6/ZOLZNavCXQSTNHjojFsvebR1nWEAs6rez9QaTAp83DkMf 5twGLq5JC7itNk5IGIvSRxde8Amc1OMMRHjSes7sXpdS079JhHH1GZY9 X-Gm-Gg: ATEYQzyyiQ4rsHBaYQDuN3scsXEdPum5rgHPZ+pUiB4NYE+3zSAz/L4p9NuCpMk8LaK RKo7zZNK4b059FGec9nn1VpMm4m2U2trgzHxLDREi5bTUpRaIh8UWSEloj57jlT9oczEv+KRHMS Es3c3EUZMklCledc3LCHNDvr++lERuMSpCBrH3Y8HrqofgfI7pF4bjwCMsoDeayuNM2QenLKsb1 mgagS4J5B8adoq41oGuj8ALQ49biDEo7oTwj09UbUouBUzeG/nQbgaHzT+9qAwL6LUQ1DCaFhuw x/neAPFRg3KmCF4hT6VR0TUBlvyxDoSMihC4SiUc6zhPaIyZucrK+hBTpAdQABdmEOmoMnLAlD5 EnhUAfj6q78R0ItRlLSCWrJ/TRbxUCKNOEGH01g88llfF1ZqhyCozGP77ctc+L7ml6vSWnPD74Z 5AdkDhjZXt7sPCuBr24FcAcBUJgAbyyzuRRraX2HZ6C+LPBbcJ X-Received: by 2002:a05:600c:820d:b0:487:467:42a2 with SMTP id 5b1f17b1804b1-487046744a1mr50811405e9.18.1774182272017; Sun, 22 Mar 2026 05:24:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2026 05:24:31 -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 08/15] irqchip/renesas-rzg2l: Split rzfive_tint_irq_endisable() into separate IRQ and TINT helpers Date: Sun, 22 Mar 2026 12:23:51 +0000 Message-ID: <20260322122421.132474-9-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 rzfive_tint_irq_endisable() handled both IRQ and TINT enable/disable paths via a hw_irq range check. Split this into two dedicated helpers, rzfive_irq_endisable() for IRQ interrupts and rzfive_tint_endisable() for TINT interrupts, each operating unconditionally on their respective interrupt type. While at it, simplify rzfive_{irq,tint}_endisable by replacing raw_spin_lock locking/unlocking with guard() and update the variable type of offset, tssr_offset, and tssr_index to unsigned int, as these variables are used only for calculation. Signed-off-by: Biju Das --- v5->v6: * Simplified rzfive_{irq,tint}_endisable by replacing raw_spin_lock locking/unlocking with guard(). * Updated the variable type of offset, tssr_offset, and tssr_index to unsigned int, in rzfive_tint_endisable() as these variables are used only for calculation. * Dropped stray newline in rzfive_tint_endisable(). * Updated commit description. v5: * New patch. --- drivers/irqchip/irq-renesas-rzg2l.c | 75 +++++++++++++++++------------ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-rene= sas-rzg2l.c index 78cf451c8798..71bde07675d9 100644 --- a/drivers/irqchip/irq-renesas-rzg2l.c +++ b/drivers/irqchip/irq-renesas-rzg2l.c @@ -212,48 +212,61 @@ static void rzfive_irqc_unmask(struct irq_data *d) irq_chip_unmask_parent(d); } =20 -static void rzfive_tint_irq_endisable(struct irq_data *d, bool enable) +static void rzfive_irq_endisable(struct irq_data *d, bool enable) { struct rzg2l_irqc_priv *priv =3D irq_data_to_priv(d); unsigned int hwirq =3D irqd_to_hwirq(d); =20 - if (hwirq >=3D IRQC_TINT_START && hwirq < IRQC_NUM_IRQ) { - u32 offset =3D hwirq - IRQC_TINT_START; - u32 tssr_offset =3D TSSR_OFFSET(offset); - u8 tssr_index =3D TSSR_INDEX(offset); - u32 reg; - - raw_spin_lock(&priv->lock); - if (enable) - rzfive_irqc_unmask_tint_interrupt(priv, hwirq); - else - rzfive_irqc_mask_tint_interrupt(priv, hwirq); - reg =3D readl_relaxed(priv->base + TSSR(tssr_index)); - if (enable) - reg |=3D TIEN << TSSEL_SHIFT(tssr_offset); - else - reg &=3D ~(TIEN << TSSEL_SHIFT(tssr_offset)); - writel_relaxed(reg, priv->base + TSSR(tssr_index)); - raw_spin_unlock(&priv->lock); - } else { - raw_spin_lock(&priv->lock); - if (enable) - rzfive_irqc_unmask_irq_interrupt(priv, hwirq); - else - rzfive_irqc_mask_irq_interrupt(priv, hwirq); - raw_spin_unlock(&priv->lock); - } + guard(raw_spinlock)(&priv->lock); + if (enable) + rzfive_irqc_unmask_irq_interrupt(priv, hwirq); + else + rzfive_irqc_mask_irq_interrupt(priv, hwirq); +} + +static void rzfive_tint_endisable(struct irq_data *d, bool enable) +{ + struct rzg2l_irqc_priv *priv =3D irq_data_to_priv(d); + unsigned int hwirq =3D irqd_to_hwirq(d); + unsigned int offset =3D hwirq - IRQC_TINT_START; + unsigned int tssr_offset =3D TSSR_OFFSET(offset); + unsigned int tssr_index =3D TSSR_INDEX(offset); + u32 reg; + + guard(raw_spinlock)(&priv->lock); + if (enable) + rzfive_irqc_unmask_tint_interrupt(priv, hwirq); + else + rzfive_irqc_mask_tint_interrupt(priv, hwirq); + reg =3D readl_relaxed(priv->base + TSSR(tssr_index)); + if (enable) + reg |=3D TIEN << TSSEL_SHIFT(tssr_offset); + else + reg &=3D ~(TIEN << TSSEL_SHIFT(tssr_offset)); + writel_relaxed(reg, priv->base + TSSR(tssr_index)); } =20 static void rzfive_irqc_irq_disable(struct irq_data *d) { irq_chip_disable_parent(d); - rzfive_tint_irq_endisable(d, false); + rzfive_irq_endisable(d, false); } =20 static void rzfive_irqc_irq_enable(struct irq_data *d) { - rzfive_tint_irq_endisable(d, true); + rzfive_irq_endisable(d, true); + irq_chip_enable_parent(d); +} + +static void rzfive_irqc_tint_disable(struct irq_data *d) +{ + irq_chip_disable_parent(d); + rzfive_tint_endisable(d, false); +} + +static void rzfive_irqc_tint_enable(struct irq_data *d) +{ + rzfive_tint_endisable(d, true); irq_chip_enable_parent(d); } =20 @@ -503,8 +516,8 @@ static const struct irq_chip rzfive_irqc_tint_chip =3D { .irq_eoi =3D rzg2l_irqc_tint_eoi, .irq_mask =3D rzfive_irqc_mask, .irq_unmask =3D rzfive_irqc_unmask, - .irq_disable =3D rzfive_irqc_irq_disable, - .irq_enable =3D rzfive_irqc_irq_enable, + .irq_disable =3D rzfive_irqc_tint_disable, + .irq_enable =3D rzfive_irqc_tint_enable, .irq_get_irqchip_state =3D irq_chip_get_parent_state, .irq_set_irqchip_state =3D irq_chip_set_parent_state, .irq_retrigger =3D irq_chip_retrigger_hierarchy, --=20 2.43.0