From patchwork Mon Jul 1 17:02:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13718460 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39390C2BD09 for ; Mon, 1 Jul 2024 17:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a5zcKBZwE+6p8VvYLEk3LAvwBsPitweKdXVyvDwdt+I=; b=VKvIggi81EjzTjpfi6MhRhKB0j 86jK/sIpVm1aFHK36i0SpHN9npYjIHgy5MT88xxR7rK+wMUcbW+nNnPMrt97MLFrYjAWQ17H5NWJR MwmX+3sHgoSff6GWuOMRJpGQ1S+kJfvqnRdrjgUHR9spQevHQHIrmoKSIyo85/2hVmwaPayVElXvJ Egpja6wLC1YPS7slBySvZKhHkWjhw+oDx6iOxtRgNb22qfSBB2oTJ/Y2PBg9lqRwad2JGc7sfwEhQ EvsFpNkqrYNklFAemzrUDlB8v6R51ImOyigodJ9sZQf0il1NL48zQ7Affw1cMxVDNTbfwyoYxGin4 +1fDT8VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOKTB-00000004Eb6-2JiG; Mon, 01 Jul 2024 17:05:37 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOKRI-00000004Dcu-1EA1 for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2024 17:03:41 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 93897616D8; Mon, 1 Jul 2024 17:03:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F12AC4AF0E; Mon, 1 Jul 2024 17:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719853419; bh=3d6dLlZo3dnaftR3/6IUTS+EOy6Ly3J2V2e8txeSycw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=llDhL6ZWzPSMaJ3Os5bewdIQpxUUGBkO3SdfVrgmUuVfJA0ZdwUehYpb8HJX81NbW TpGg4+SJ2tPeIWcvoDXTMgaMa9HgwPbQ9OF/k9BMF+eXtNaI7Og45SHAaQFNcqCGcD xj7uz7AIx0f7ur7bgmSoITEOnd0x+w7a3rMBVP9k3VFo+KvIh9yauY/rG+L+Hjk1mV hzxN1oCjdXQO6Muc4pN4o4PMqyBYavOGuyOm21OkZhm04FEHTiGhs3og3hIWh2MEDK NGRQEOdsJKF3kzh4iDX1b/F1NFSd3v/eG9OfHg+1vxNx+A06dCJtioa3w9Ip/m9LLb vz0KYKBkGW+/w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH 17/25] irqchip/armada-370-xp: Refactor mpic_handle_msi_irq() code Date: Mon, 1 Jul 2024 19:02:41 +0200 Message-ID: <20240701170249.8128-18-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240701170249.8128-1-kabel@kernel.org> References: <20240701170249.8128-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_100340_453040_BD78524C X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor the mpic_handle_msi_irq() function to make it simpler: - use for_each_set_bit() - rename the variable holding the doorbell cause register to cause Signed-off-by: Marek BehĂșn Reviewed-by: Andrew Lunn --- drivers/irqchip/irq-armada-370-xp.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index d8db46001961..9e8b189da1d1 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -618,24 +618,15 @@ static const struct irq_domain_ops mpic_irq_ops = { #ifdef CONFIG_PCI_MSI static void mpic_handle_msi_irq(struct pt_regs *regs, bool is_chained) { - u32 msimask, msinr; + unsigned long cause, nr; - msimask = readl_relaxed(per_cpu_int_base + MPIC_IN_DRBEL_CAUSE); - msimask &= msi_doorbell_mask(); + cause = readl_relaxed(per_cpu_int_base + MPIC_IN_DRBEL_CAUSE); + cause &= msi_doorbell_mask(); + writel(~cause, per_cpu_int_base + MPIC_IN_DRBEL_CAUSE); - writel(~msimask, per_cpu_int_base + MPIC_IN_DRBEL_CAUSE); - - for (msinr = msi_doorbell_start(); - msinr < msi_doorbell_end(); msinr++) { - unsigned int irq; - - if (!(msimask & BIT(msinr))) - continue; - - irq = msinr - msi_doorbell_start(); - - generic_handle_domain_irq(mpic_msi_inner_domain, irq); - } + for_each_set_bit(nr, &cause, BITS_PER_LONG) + generic_handle_domain_irq(mpic_msi_inner_domain, + nr - msi_doorbell_start()); } #else static void mpic_handle_msi_irq(struct pt_regs *r, bool b) {}