From patchwork Thu Jul 11 11:57:47 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: 13730638 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 E0A44C3DA41 for ; Thu, 11 Jul 2024 12:00:52 +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=niVkIcLBEPv3gFebkf+tRP7nroayGeyiZJfWl+j+xjM=; b=Ym/OpFJzbujdPa5WiDeUkoF6sj ioZUaUmhPDOyHbd8QJ/Mx9b2p8hKGXeHJyZNb1MZJQSTvUYrZ6puO8qv+MmytBDuJ2e8zG239OuX4 U695AeSWy/E3cyliJrwiuh2j/DYJwARQsg0lHoK+V9uQuITeev2kg10LMjtAngOAVOOYD1jYqCT+X 2KEWJGXf9KpXLvzWmy+vUGZQ99MKavhnapaoDZ63RousB6GI19I7LVhNTuzvPkTjdJTa5ttHT0imd j4xLdzRLVB6r0ogyoxrv4UsmXdxxqfhSArP4v4TOYAn++54JGoRXYnxFm5MXuvUzx7bLZqE035edb QZfFNtPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRsTU-0000000DsuL-3J4Z; Thu, 11 Jul 2024 12:00:36 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRsRI-0000000Ds0d-18Dd for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2024 11:58:21 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A123ACE18B3; Thu, 11 Jul 2024 11:58:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A69F5C32786; Thu, 11 Jul 2024 11:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720699097; bh=/F5QKnDgCb64XIg4m2azJjp86vnwV5WtQF/OIgizkd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugmeblTR2rXY4PL8MM6X45jcO/bqRiouoGGj0eicCHmAQw0ppHRdgGqhO3JOBa3VJ HjktiX20c6/LJkaWec9Pe8oWn1v05pGy2JTa0J9xjAJrC2yut7VLcTRxbPg3p2GYok 8cnT2yYyO3ategMVOnfve8BbWjThGiC+H+l4Qg0TiRX15oRoHPKVJKQXHDho6/miyc XDkWGHIQxQ4s0E2CtgdwZCj5GN/8YIW75Vmyzj2vFt/0G1gqF53YZ065j3YUI4qwzt yTkKlOsnMUGYPocdsMnZC1xfg5D31NZIZuNiywm6izBlma2cpq4Cud4A8eCredyxAz RWILALiEUJY1g== 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 09/10] irqchip/armada-370-xp: Refactor mpic_handle_msi_irq() code Date: Thu, 11 Jul 2024 13:57:47 +0200 Message-ID: <20240711115748.30268-10-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240711115748.30268-1-kabel@kernel.org> References: <20240711115748.30268-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240711_045820_679834_52B589CE X-CRM114-Status: GOOD ( 11.85 ) 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: - drop the function arguments, they are not needed - rename the variable holding the doorbell cause register to "cause" - rename the iterating variable to "i" - use for_each_set_bit() (requires retyping "cause" to unsigned long) Signed-off-by: Marek BehĂșn Reviewed-by: Andrew Lunn --- drivers/irqchip/irq-armada-370-xp.c | 32 +++++++++++------------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index 6f71bf08831f..b31bf6c43a8b 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -618,29 +618,21 @@ 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) +static void mpic_handle_msi_irq(void) { - u32 msimask, msinr; + unsigned long cause; + unsigned int i; - 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(i, &cause, BITS_PER_LONG) + generic_handle_domain_irq(mpic_msi_inner_domain, + i - msi_doorbell_start()); } #else -static void mpic_handle_msi_irq(struct pt_regs *r, bool b) {} +static void mpic_handle_msi_irq(void) {} #endif static void mpic_handle_cascade_irq(struct irq_desc *desc) @@ -663,7 +655,7 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) continue; if (irqn == 0 || irqn == 1) { - mpic_handle_msi_irq(NULL, true); + mpic_handle_msi_irq(); continue; } @@ -691,7 +683,7 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) /* MSI handling */ if (irqnr == 1) - mpic_handle_msi_irq(regs, false); + mpic_handle_msi_irq(); #ifdef CONFIG_SMP /* IPI Handling */