Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1581807pxb; Fri, 22 Oct 2021 03:55:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfMmVJ47n3CgTG6rUX5aS8szSPhTwI9TjjqmIisUYYOwwey8KZWIs8Tn9QJup39eS4clTE X-Received: by 2002:a63:18d:: with SMTP id 135mr8984818pgb.78.1634900116871; Fri, 22 Oct 2021 03:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634900116; cv=none; d=google.com; s=arc-20160816; b=UmN0Z2DrQylkKvQX20tWeZA+ZKSqh8ayR546Z23zQeiQ5GxU590IfEmrQxWWuLL22i 8/2vVclqTcBVjVZkQEyDBo0dtJF1AqfJ1Xmz4mqjHC0nueuRJsU1HLWr1QDNayQtgfFj 0JqUiBsSTrapgyn7Zk1nqF2uo8WvYcB6xQCWh9N0hWigf1s4Q/p4IZVvzLgKQ0tVnnWR +nqk2H6ljecXbqiKqmYjTpIN+WsI5CSwsVrkKGR7QWMbbKxBJRz9W76y2CXK4aYu1/Ih aWEpz66XMgkW/7Yzl7OTD7QomfQCvMgiZ08xK5sWwjrTobVQugG9fE2UnSriHzNr9T10 kYxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=isfyIMhnJovwWg+JFjtbNFQv+6JuM1tcEkw722nh38w=; b=WU5yzO85zdtsCJ7Xed390qHEsD37jEPv+suMyJJHvD1k+rUB65l1XPHEs4Ehy4xrh6 h7LikyQwLEGfVbveq/FNE7luvWzD8OTjxDYQCh5Nvbdo0JiZ7aOGoFZC45sEKkA17Hp3 /2lTOWVJ9+BU5ucpcEHZWRoAlRuWAgFspvNQpuvfie/9+oZ7qIq7eaIktrHX1VvPbCNa uhJwKmTMosR4bvuxWSMAPb3ha7QFh8/EQsWP2LOxQ35WVOgoh/NuKCzWCXWCiMqmFqrs Jqf++Sg9Jz37J5G+eBPLri3JeI9GaiiaY7iYWb807XUVkQB3tZiUn0lxaoKZssJIhZuU +qjw== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si12126245pgg.278.2021.10.22.03.55.04; Fri, 22 Oct 2021 03:55:16 -0700 (PDT) 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbhJVKyv (ORCPT + 99 others); Fri, 22 Oct 2021 06:54:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232693AbhJVKys (ORCPT ); Fri, 22 Oct 2021 06:54:48 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F02B960F02; Fri, 22 Oct 2021 10:52:30 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mdsA0-000u3l-Q0; Fri, 22 Oct 2021 11:52:28 +0100 Date: Fri, 22 Oct 2021 11:52:28 +0100 Message-ID: <87lf2lbac3.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland Cc: linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org Subject: Re: [PATCH 04/15] irq: simplify handle_domain_{irq,nmi}() In-Reply-To: <20211021180236.37428-5-mark.rutland@arm.com> References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-5-mark.rutland@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Oct 2021 19:02:25 +0100, Mark Rutland wrote: > > There's no need for handle_domain_{irq,nmi}() to open-code the NULL > check performed by handle_irq_desc(), nor the resolution of the desc > performed by generic_handle_domain_irq(). > > Use generic_handle_domain_irq() directly, as this is functioanlly > equivalent and clearer. At the same time, delete the stale comments, > which are no longer helpful. > > There should be no functional change as a result of this patch. > > Signed-off-by: Mark Rutland > Cc: Marc Zyngier > Cc: Thomas Gleixner > --- > kernel/irq/irqdesc.c | 24 ++++-------------------- > 1 file changed, 4 insertions(+), 20 deletions(-) > > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 4e3c29bb603c..b07d0e1552bc 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -690,17 +690,11 @@ int handle_domain_irq(struct irq_domain *domain, > unsigned int hwirq, struct pt_regs *regs) > { > struct pt_regs *old_regs = set_irq_regs(regs); > - struct irq_desc *desc; > - int ret = 0; > + int ret; > > irq_enter(); > > - /* The irqdomain code provides boundary checks */ > - desc = irq_resolve_mapping(domain, hwirq); > - if (likely(desc)) > - handle_irq_desc(desc); > - else > - ret = -EINVAL; > + ret = generic_handle_domain_irq(domain, hwirq); > > irq_exit(); > set_irq_regs(old_regs); > @@ -721,24 +715,14 @@ int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq, > struct pt_regs *regs) > { > struct pt_regs *old_regs = set_irq_regs(regs); > - struct irq_desc *desc; > - int ret = 0; > + int ret; > > /* > * NMI context needs to be setup earlier in order to deal with tracing. > */ > WARN_ON(!in_nmi()); > > - desc = irq_resolve_mapping(domain, hwirq); > - > - /* > - * ack_bad_irq is not NMI-safe, just report > - * an invalid interrupt. > - */ > - if (likely(desc)) > - handle_irq_desc(desc); > - else > - ret = -EINVAL; > + ret = generic_handle_domain_irq(domain, hwirq); > > set_irq_regs(old_regs); > return ret; Yup, that's really neat. I somehow missed that when I moved some of the legacy stuff to be ARM specific. On a vaguely related note, I think you can drop the EXPORT_SYMBOL_GPL on handle_irq_desc() now. M. -- Without deviation from the norm, progress is not possible.