Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1908989pxu; Tue, 24 Nov 2020 11:48:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDNJ2WptmOmpCdc8OjEUho6MZWnkPB81xdh8LV6GAkT5Bk6kyr0IMMjq3yI7vyhngrrfaQ X-Received: by 2002:a17:906:f855:: with SMTP id ks21mr21435ejb.356.1606247329524; Tue, 24 Nov 2020 11:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606247329; cv=none; d=google.com; s=arc-20160816; b=idh/vy/LjvLBz3VNyZWy6APegQvPfeumwk04HYvf4dwMl10Vx5wy9Ug+KW59pvWtRP UGu0yuC66V7oyy8Xe1HHIj2gdNdo188Q7Zngu7fLOhzHjx+U1gfX9bAmKCd9gR34wXz1 2hf8toCZDDPBByKdflPHibvyLFgGITa+m10Ms4L6TupaRGL3p25S5eUUlor4CIDDSASA bfFCMEVm5ILtz2GsItAGSQmz3Bje433TANMwb0eI2rZBYSSigU8r6xdIqr99dAj+6u3t oJ+rwYBYrKjrA2LiRS0V0CSr2STC127j+IbXT5enir+X/i9z/R2gXD+EX/HJ/So2/jVN uMFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=jy2BVRa/brGiyQRogsx5f0h1WLmX8muGKN/Ptgk4Nfs=; b=ECaen5ArbT8SiEtLGnt1p72SiOmGNzswr5WOTar8MCjCVw3nEXH3dZiaYKfs7eZ0sf 6GhqBYuVFK7kNxcwIZTMlntRUdTcGpziWnep3TQ7eLHMO4WDeO34hmT1dBNJulNyMyz5 +zq/PuBghxE6x5DWekBQpqD+o8s+GhP5EUe2sgJky7qKqN5TqqiLm9pMyIt+Wu3ZI/7n sW9gDQaWrFTERiIDJOf9jkx/og4XQyL53717N50FXdWGyyTibrUp/PWSz3A8FdVW8WON c4RosARoS9lqphx3EKALCQxr0vmhWOUt8N7wUk8F/vlVJmk9W7xyiDwLGypaBb2FTVbA gyzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si9077784edf.226.2020.11.24.11.48.26; Tue, 24 Nov 2020 11:48:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728449AbgKXGSQ (ORCPT + 99 others); Tue, 24 Nov 2020 01:18:16 -0500 Received: from ozlabs.ru ([107.174.27.60]:49668 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbgKXGSP (ORCPT ); Tue, 24 Nov 2020 01:18:15 -0500 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 Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Frederic Barrat , =?UTF-8?q?Michal=20Such=C3=A1nek?= , "Oliver O'Halloran" , Marc Zyngier , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, Alexey Kardashevskiy 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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; } /** -- 2.17.1