Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2673584lqo; Tue, 14 May 2024 06:12:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMfJuHkVYadKt9SN3zuZTxqjeQYcQyCU8Go2HDqMbINnfHllzKaM5qTpzrYqZ13HiFH5YgEpy7OYY6MtHsV8bvSEEXucCePRW8GBJibQ== X-Google-Smtp-Source: AGHT+IFODVQqtkGzl0uELaV8xy6MUqxKNCbiCv3qIRbgXs89FRe+u7jmmpsizIgsIkM1PCgjpZH6 X-Received: by 2002:a05:6358:5245:b0:192:59ac:6694 with SMTP id e5c5f4694b2df-193bb638943mr956395355d.16.1715692343807; Tue, 14 May 2024 06:12:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715692343; cv=pass; d=google.com; s=arc-20160816; b=isMHBudDRmVchVir1RPwuASueFCt2kgsKXYYf5pJwpKz1TboagmoAtmLevG1nQEp+2 qmlMNKEsZ4YmWZF7HbhNVmAD4fxugUErjddLtZYCAdg/pFuCoCzptGlKVcMHrUVWnpWj /ompubY/quRnjqLV6XO8TXuIFUE9Wj60fTFJQW8RRKXLiDAKGAFh7HweGmzEi27c2Kxg kt1KYIPDgreP/UpmBvXZ4zL98xldBL+sbAAuKEfTB//HOdAJaDyS2uE1IBrqyzE0JRSk 6z+deNYtGwpCTqV908H7ibGxCT3FR62XjnY4XPZnllaKXhRRk+X/LfgrvqKfdTRkzArf G6Mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=u3Rp7oM4Y8P/y0Vphyf5VvQ+phxtNXye+/YTndoVkvU=; fh=dXnr7tqGDTNtcN4J+OEYZphvR37nRqlGnzPAqcT2GsM=; b=oU7lINgdf4eVQXScLRQNtD3vlSRGS5qe+5od7mZRguX1muLRlX3E8YxJUWKi1yQQ69 AmPhdDVRzL/tVW0S37oEL+fks1ElAc7ui7HP9M6crPye6YvstihGoJcRlFYbqaTuKOiB 0g89j0ZXrZ65loxRe6vB1fbmhSuG/+PNzecAVDmjxc5jRSia+QvWrMnzCKgLeddJh+RW O8D6kl0oNBwPuZfZ9lc7HjVp1dL1y37HhHjap4FUkBRNRPpkeMSMhU5Rig1yOkv6OIvV NHXliZKHjwLfeT+Vce28pQ1IB0hWY1XY+A7gVRAJtOJZ46gg7V2gPycTjwRifGVxofGl DZGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-178704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63d32c22781si6165288a12.666.2024.05.14.06.12.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 06:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-178704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 53011B2204A for ; Tue, 14 May 2024 13:11:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22420141987; Tue, 14 May 2024 13:11:24 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 224C81411E7 for ; Tue, 14 May 2024 13:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692283; cv=none; b=BFeadTZu7ItgBQNIHJSUa2tLyVvd/7/3AqcUkWw7PF4aflsAOMJB9IYp4w/4Vu42YF+9eu41q6uEk/6mhpoASl6XCBB2Choa93S2seZNRSGFyHB+KTuD9lylzugfC1PoGF7PXa8UK0v9Ju+FOCGzzKopo0FF0yviAGuMHPw4qyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715692283; c=relaxed/simple; bh=EFrWLGeK8DYkOeYKEgBZUG6UC+AvHnAbzCcC59Su6VA=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=OtgtObc44wKqUgDddmHAm3Tt5bkiprnCUluajN8IsCoiJTgSrVHE/FBFtU+jABOsC7Qa+6z+CGBINvJmGSsEKQm5g9k6q1DTXCSAjTSP4tdxKbuv4kdH8iKSXkMGfvWnp/L2noz5iQddk9t5tMXvKXDK/8D/Gqax6WqbrqnT84w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4VdxVw52TGzPlKS for ; Tue, 14 May 2024 21:08:24 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 2450E18007E for ; Tue, 14 May 2024 21:11:18 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 14 May 2024 21:11:17 +0800 Message-ID: <668e65d3-f7a5-2387-bad8-d4b29bb69563@huawei.com> Date: Tue, 14 May 2024 21:11:16 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] genirq: Clean code for handle_edge_irq() Content-Language: en-US To: , References: <20240514130915.2613753-1-ruanjinjie@huawei.com> From: Jinjie Ruan In-Reply-To: <20240514130915.2613753-1-ruanjinjie@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500008.china.huawei.com (7.221.188.139) On 2024/5/14 21:09, Jinjie Ruan wrote: > The pending set and mask_ack_irq() repeated twice, a new goto label can > reduce a few lines of code, with no functional changes. > > Signed-off-by: Jinjie Ruan > --- > kernel/irq/chip.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c > index 638cf5eee04b..4613dc9ff6b6 100644 > --- a/kernel/irq/chip.c > +++ b/kernel/irq/chip.c > @@ -775,21 +775,15 @@ void handle_edge_irq(struct irq_desc *desc) > > desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); > > - if (!irq_may_run(desc)) { > - desc->istate |= IRQS_PENDING; > - mask_ack_irq(desc); > - goto out_unlock; > - } > + if (!irq_may_run(desc)) > + goto out_mask_ack; > > /* > * If its disabled or no action available then mask it and get > * out of here. > */ > - if (irqd_irq_disabled(&desc->irq_data) || !desc->action) { > - desc->istate |= IRQS_PENDING; > - mask_ack_irq(desc); > - goto out_unlock; > - } > + if (irqd_irq_disabled(&desc->irq_data) || !desc->action) > + goto out_mask_ack; > > kstat_incr_irqs_this_cpu(desc); > > @@ -818,6 +812,9 @@ void handle_edge_irq(struct irq_desc *desc) > } while ((desc->istate & IRQS_PENDING) && > !irqd_irq_disabled(&desc->irq_data)); > > +out_mask_ack: > + desc->istate |= IRQS_PENDING; > + mask_ack_irq(desc); Please ignore this patch, this is a generic export and should not be used as such. > out_unlock: > raw_spin_unlock(&desc->lock); > }