From patchwork Tue Nov 24 06:17:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 11927245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77879C63798 for ; Tue, 24 Nov 2020 06:19:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBCE320678 for ; Tue, 24 Nov 2020 06:19:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GkCPb97u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBCE320678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ozlabs.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zSc9Fbe3rh8+pbJf/i2mmS94Qi1TujkCrhqrix2Fy6w=; b=GkCPb97u1Pn3FPVGeTj9E745gm zRDHW66ENE6/ibrHKo291L5leAKrc/9V6c7oUdCGEBM0GJ2QLedN6r4XJNZef6zmcHL86j8xWaR80 1sYSmQHxDsz/f+IZ1Q/yxaL7nkYmu+ckyU/7RhaqWapW+AsVGKQM8tei9qQuAhA/s1qtm943eN5ZI j3Iuwrq7ZQuaTcmyCgQ9JB4A1HbnrnCEqVTWqPP1SjAkvhYSw/xSVTR+KktLDqxMoy4ujMwPAsbbe 15THlvkLS02z+etuKWYbeVuBBZKq2Tdl8lKKaEAJytnaXgIvmAF3EydDymLoaiiy1xE0gYhg1HRyP xK3wEm2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khReC-0007F5-SA; Tue, 24 Nov 2020 06:17:52 +0000 Received: from ozlabs.ru ([107.174.27.60]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khReA-0007ES-1m for linux-arm-kernel@lists.infradead.org; Tue, 24 Nov 2020 06:17:50 +0000 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 82CBCAE8022C; Tue, 24 Nov 2020 01:17:40 -0500 (EST) From: Alexey Kardashevskiy To: linux-kernel@vger.kernel.org Subject: [PATCH kernel v4 1/8] genirq/ipi: Simplify irq_reserve_ipi Date: Tue, 24 Nov 2020 17:17:13 +1100 Message-Id: <20201124061720.86766-2-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201124061720.86766-1-aik@ozlabs.ru> References: <20201124061720.86766-1-aik@ozlabs.ru> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201124_011750_175248_652E31F2 X-CRM114-Status: GOOD ( 10.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , Marc Zyngier , x86@kernel.org, linux-gpio@vger.kernel.org, Oliver O'Halloran , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Frederic Barrat , Thomas Gleixner , =?utf-8?q?Michal_Such=C3=A1nek?= , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __irq_domain_alloc_irqs() can already handle virq==-1 and free descriptors if it failed allocating hardware interrupts so let's skip this extra step. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Cédric Le Goater --- kernel/irq/ipi.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/irq/ipi.c b/kernel/irq/ipi.c index 43e3d1be622c..1b2807318ea9 100644 --- a/kernel/irq/ipi.c +++ b/kernel/irq/ipi.c @@ -75,18 +75,12 @@ int irq_reserve_ipi(struct irq_domain *domain, } } - virq = irq_domain_alloc_descs(-1, nr_irqs, 0, NUMA_NO_NODE, NULL); - if (virq <= 0) { - pr_warn("Can't reserve IPI, failed to alloc descs\n"); - return -ENOMEM; - } - - virq = __irq_domain_alloc_irqs(domain, virq, nr_irqs, NUMA_NO_NODE, - (void *) dest, true, NULL); + virq = __irq_domain_alloc_irqs(domain, -1, nr_irqs, NUMA_NO_NODE, + (void *) dest, false, NULL); if (virq <= 0) { pr_warn("Can't reserve IPI, failed to alloc hw irqs\n"); - goto free_descs; + return -EBUSY; } for (i = 0; i < nr_irqs; i++) { @@ -96,10 +90,6 @@ int irq_reserve_ipi(struct irq_domain *domain, irq_set_status_flags(virq + i, IRQ_NO_BALANCING); } return virq; - -free_descs: - irq_free_descs(virq, nr_irqs); - return -EBUSY; } /**