Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1536359rwn; Thu, 15 Sep 2022 18:13:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TyXDzrBn7s9TZmzSjqh58f5TZAtD0utDY6bS0BZcanhQn0ZfGP0Xfbo/598i8+t1Ksvdd X-Received: by 2002:a05:6402:27c8:b0:451:440a:2f48 with SMTP id c8-20020a05640227c800b00451440a2f48mr1975206ede.1.1663290787017; Thu, 15 Sep 2022 18:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663290787; cv=none; d=google.com; s=arc-20160816; b=uELkJuk/oxPoi1g+0PbaHifMdun2l36wQ7x1jWSkHfemsxvvxe4R1W3cFkQPZGODrU xZc/xF/i8JKpxfXZ+pA3iFtrAH7X1GmNadxUe03Xxjw0j4gs8q9VmnoS76nmfEA0wUnm 4IyLXuO/qPusDYwDGbi9m1kNDpWfSpJud+aHmmIBADRtZlsYxpYsQeOBpBc7JlrInK8l 7TNf1iCgFlFrsCDEUcww9ezMPXU47/2kISvI9VKuAw5T6KGvtmGvu7EYYLqtWiUutiF1 RAXEGR4l53dvesMTj/jreOR2xeDKQn1cLUWELJbjavDCDUu4Hedvc0iNJaEMQQ1tNHPN gB2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=iaCyNKNwBi3hL+pcHan6vN3XbXEwTL8fxraDtFWPJuM=; b=USQsDwueObaFxnLFW6hBTYpLCOEneay+Ra7VufexoqYAzbJGackvY/5ImCM/oETKvH k2NeOw+eD9oLP4Q5ISYMsIR6yj+VwiTpBiZj9jEdVWEtZ90zuY5d0SsTC3Q7bkFmWA++ yCKnK9EEjoXKuxw5bzlvdMebtLAE94GjZAzG8RD299BDYE5E2is6qA49t501GBQEpt6s SniMDkeSL6z5304e3ZHUMEIfnKUiWZOtXNSfgXxPocscgDAV0UrPXNhuatIeeb/ezGgV UxkI6gDNSfpEi433FtQs7kyuOjOkAsF3a/gGAYTRKBdxFy/t5u/92aEHVbHpIPjuXyAr llNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa8-20020a170906fd8800b0072b1964e54esi16952973ejb.1007.2022.09.15.18.12.42; Thu, 15 Sep 2022 18:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbiIPBAq (ORCPT + 99 others); Thu, 15 Sep 2022 21:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbiIPBAo (ORCPT ); Thu, 15 Sep 2022 21:00:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C466068D for ; Thu, 15 Sep 2022 18:00:43 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTFyK0B85zlVk0; Fri, 16 Sep 2022 08:56:41 +0800 (CST) Received: from [10.67.110.73] (10.67.110.73) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 09:00:40 +0800 Message-ID: Date: Fri, 16 Sep 2022 09:00:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH -next] genirq: Change can_request_irq() return value type to bool To: Marc Zyngier CC: , , , , , References: <20220914110615.3570933-1-chris.zjh@huawei.com> <87wna6kvv5.wl-maz@kernel.org> From: "zhangjianhua (E)" In-Reply-To: <87wna6kvv5.wl-maz@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.73] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fine, thanks. 在 2022/9/14 20:01, Marc Zyngier 写道: > On Wed, 14 Sep 2022 12:06:15 +0100, > Zhang Jianhua wrote: >> The function can_request_irq() is used to judge whether the irq can be >> allocated, so bool type would be more suitable for it. >> >> Signed-off-by: Zhang Jianhua >> --- >> include/linux/irq.h | 2 +- >> kernel/irq/manage.c | 8 ++++---- >> 2 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/include/linux/irq.h b/include/linux/irq.h >> index c3eb89606c2b..3a60c2313fb9 100644 >> --- a/include/linux/irq.h >> +++ b/include/linux/irq.h >> @@ -707,7 +707,7 @@ extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret); >> extern int noirqdebug_setup(char *str); >> >> /* Checks whether the interrupt can be requested by request_irq(): */ >> -extern int can_request_irq(unsigned int irq, unsigned long irqflags); >> +extern bool can_request_irq(unsigned int irq, unsigned long irqflags); >> >> /* Dummy irq-chip implementations: */ >> extern struct irq_chip no_irq_chip; >> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c >> index 40fe7806cc8c..d6940d15bf56 100644 >> --- a/kernel/irq/manage.c >> +++ b/kernel/irq/manage.c >> @@ -925,19 +925,19 @@ EXPORT_SYMBOL(irq_set_irq_wake); >> * particular irq has been exclusively allocated or is available >> * for driver use. >> */ >> -int can_request_irq(unsigned int irq, unsigned long irqflags) >> +bool can_request_irq(unsigned int irq, unsigned long irqflags) >> { >> unsigned long flags; >> struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); >> - int canrequest = 0; >> + bool canrequest = false; >> >> if (!desc) >> - return 0; >> + return false; >> >> if (irq_settings_can_request(desc)) { >> if (!desc->action || >> irqflags & desc->action->flags & IRQF_SHARED) >> - canrequest = 1; >> + canrequest = true; >> } >> irq_put_desc_unlock(desc, flags); >> return canrequest; > I'm sorry, but this is a very pointless change. Not only this doesn't > change anything for this particular code other than being cosmetic, > but it also doesn't help any of the callers which are still using an > int. > > In general, this sort of patch only adds noise, and I'd like to see > less of them. > > Thanks, > > M. >