Message ID | 20230704120517.1322195-1-LeoLiu-oc@zhaoxin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1173734vqx; Tue, 4 Jul 2023 05:13:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/SpTTVXihxKc8y9cG7VDPdEnB12mHnHyhq6vueo1SBbKJaBu8SjDhrTyM/Lt3Qe8CJWws X-Received: by 2002:a17:902:ce8d:b0:1b8:400a:48ea with SMTP id f13-20020a170902ce8d00b001b8400a48eamr15158784plg.63.1688472822578; Tue, 04 Jul 2023 05:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688472822; cv=none; d=google.com; s=arc-20160816; b=HXN9jGcPWKap6/i0XQBqeQTTd/UjvHQ4k/piDeZAH6B5KJHzehRd+/NB1LLIEL6Sgt Rkt+3roB5HeUwaGfKLOeBqnNzNMGEtYCZyLISiGhEqsiNmprKqRM2rkjWBSW9E2SlDjE w2mgX0UEWpixAbAyx+o+GKT9vlh7RPv+VVs7ArWYcui33QwDbchgT7kXOeLUIud9qzi0 laA5sAmAwM92JFyEFDF0w+WWE7/ZCB7NmKv10q1rAQK19Nor0kcRZNWgf7eriAzPNxZw LYAQU8WbAvb89QxOVpdCca/hnRSZr99UIvFuGyVrAPrIUhWKvkiEMUKT9k+uCtHDjsKs o0Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=JU77kZm9w92XC6OXyQfyIjgF7uXAevn+7Lhu8EZNzGw=; fh=iIV36Dgdh4LzvyKE3JHia3Vj+ViV+F528zNAqnPmggE=; b=XzvzLxmIgmJ64RKXkBVsmMmzE8dTbhpRFxBrVAS3xElki24bxFIjC9NqHBotsOaHdx ZVKCwBP6rcLoMST8Fs70Gihfv6RS2Yn0MLcbKu1hFYA5Ghgh9yxCmOFIC31kUgBLTFTX xmk+m9TErVX/YfODuAF9wlcBtpj4jtkDDKcNJHM7qUwK+X5eNy8mfEr2UfnfGScrdeLD 9Xv0404R9YKmAUY9cVFYSBHOdVyy0z+e61Syg6eQAPT/3DECoEWTYtWp1dvZVujcMwSv NJSKi/tNV82enmwhnEZGWwQ/10JCZiCuEPmSFjMjc8vn3H62GRhZdNwdhJK6iTfmy3Cd YxpQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020a170902e41300b001b7ea20dbf2si18013684ple.224.2023.07.04.05.13.28; Tue, 04 Jul 2023 05:13:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjGDMF2 (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Tue, 4 Jul 2023 08:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbjGDMFY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 4 Jul 2023 08:05:24 -0400 Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7844E62 for <linux-kernel@vger.kernel.org>; Tue, 4 Jul 2023 05:05:22 -0700 (PDT) X-ASG-Debug-ID: 1688472320-1eb14e179f10210001-xx1T2L Received: from ZXSHMBX1.zhaoxin.com (ZXSHMBX1.zhaoxin.com [10.28.252.163]) by mx2.zhaoxin.com with ESMTP id KPRdqURlNPZNorAm (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 04 Jul 2023 20:05:20 +0800 (CST) X-Barracuda-Envelope-From: LeoLiu-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 Received: from ZXBJMBX03.zhaoxin.com (10.29.252.7) by ZXSHMBX1.zhaoxin.com (10.28.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 4 Jul 2023 20:05:19 +0800 Received: from xin.lan (10.32.64.1) by ZXBJMBX03.zhaoxin.com (10.29.252.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 4 Jul 2023 20:05:18 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 From: LeoLiu-oc <LeoLiu-oc@zhaoxin.com> X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.7 To: <lenb@kernel.org>, <james.morse@arm.com>, <tony.luck@intel.com>, <bp@alien8.de>, <bhelgaas@google.com>, <robert.moore@intel.com>, <leoliu-oc@zhaoxin.com>, <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>, <acpica-devel@lists.linuxfoundation.org> Subject: [PATCH v3 2/5] ACPI/APEI: Remove static from apei_hest_parse() Date: Tue, 4 Jul 2023 20:05:17 +0800 X-ASG-Orig-Subj: [PATCH v3 2/5] ACPI/APEI: Remove static from apei_hest_parse() Message-ID: <20230704120517.1322195-1-LeoLiu-oc@zhaoxin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.32.64.1] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX03.zhaoxin.com (10.29.252.7) X-Barracuda-Connect: ZXSHMBX1.zhaoxin.com[10.28.252.163] X-Barracuda-Start-Time: 1688472320 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 1646 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.110906 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770492078222298107?= X-GMAIL-MSGID: =?utf-8?q?1770492078222298107?= |
Series |
[v3,1/5] ACPI/APEI: Add apei_hest_parse_aer()
|
|
Commit Message
LeoLiu-oc
July 4, 2023, 12:05 p.m. UTC
From: leoliu-oc <leoliu-oc@zhaoxin.com> Each dev with AER capability needs to call the apei_hest_parse function to match and extract register values from HEST PCIe AER structures. Therefore, remove static from apei_hest_parse() so that it can be called in another file. Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com> --- drivers/acpi/apei/hest.c | 2 +- include/acpi/apei.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
Comments
On Tue, Jul 04, 2023 at 08:05:17PM +0800, LeoLiu-oc wrote: > From: leoliu-oc <leoliu-oc@zhaoxin.com> > > Each dev with AER capability needs to call the apei_hest_parse function to > match and extract register values from HEST PCIe AER structures. > Therefore, remove static from apei_hest_parse() so that it can be called > in another file. Can you reword the subject line and commit log in the positive? "Removing static" is a negative thing and it's semantically a bit too low level -- it's clearly what the *code* does, but we can see that from the patch, and what we want to know here is *why* it's important. What this really does is expose apei_hest_parse() for use by other subsystems. Browsing the drivers/acpi commit log history, I see that Rafael adds "()" after function names, so please do the same here (you did do that once above, but not in the first line). > Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com> > --- > drivers/acpi/apei/hest.c | 2 +- > include/acpi/apei.h | 5 +++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c > index fb839a5c480ee..fd40c035c9b2e 100644 > --- a/drivers/acpi/apei/hest.c > +++ b/drivers/acpi/apei/hest.c > @@ -132,7 +132,7 @@ static bool hest_match_pci(struct acpi_hest_header *hest_hdr, > return false; > } > > -static int apei_hest_parse(apei_hest_func_t func, void *data) > +int apei_hest_parse(apei_hest_func_t func, void *data) If this is going to exported to the PCI subsystem, I think it needs some kernel-doc. For example, it's important to know that it stops parsing the HEST if func returns anything non-zero. This is how pci_acpi_program_hest_aer_params() knows that it got good data that matches the device it wants. Given the fact that apei_hest_parse_aer() fills in the struct acpi_hest_parse_aer_info with pointers into the HEST table data, it's also important to know that this HEST table data is persistent. > { > struct acpi_hest_header *hest_hdr; > int i, rc, len; > diff --git a/include/acpi/apei.h b/include/acpi/apei.h > index 8a0b2b9edbafe..f975e4fe78fcb 100644 > --- a/include/acpi/apei.h > +++ b/include/acpi/apei.h > @@ -37,9 +37,14 @@ typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); > > #ifdef CONFIG_ACPI_APEI > void __init acpi_hest_init(void); > +int apei_hest_parse(apei_hest_func_t func, void *data); > int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data); > #else > static inline void acpi_hest_init(void) { } > +static inline int apei_hest_parse(apei_hest_func_t func, void *data) > +{ > + return -EINVAL; > +} > static inline int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data) > { > return -EINVAL; > -- > 2.34.1 >
在 2023/8/11 7:17, Bjorn Helgaas 写道: > On Tue, Jul 04, 2023 at 08:05:17PM +0800, LeoLiu-oc wrote: >> From: leoliu-oc <leoliu-oc@zhaoxin.com> >> >> Each dev with AER capability needs to call the apei_hest_parse function to >> match and extract register values from HEST PCIe AER structures. >> Therefore, remove static from apei_hest_parse() so that it can be called >> in another file. > > Can you reword the subject line and commit log in the positive? > "Removing static" is a negative thing and it's semantically a bit too > low level -- it's clearly what the *code* does, but we can see that > from the patch, and what we want to know here is *why* it's important. > What this really does is expose apei_hest_parse() for use by other > subsystems. > > Browsing the drivers/acpi commit log history, I see that Rafael adds > "()" after function names, so please do the same here (you did do that > once above, but not in the first line). > This function is required in patch v3 4/5 to traverse the HEST to find the HEST AER structures, so changed the definition to be global. I will pay attention to this matter in the next version. LeoLiu-oc >> Signed-off-by: leoliu-oc <leoliu-oc@zhaoxin.com> >> --- >> drivers/acpi/apei/hest.c | 2 +- >> include/acpi/apei.h | 5 +++++ >> 2 files changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c >> index fb839a5c480ee..fd40c035c9b2e 100644 >> --- a/drivers/acpi/apei/hest.c >> +++ b/drivers/acpi/apei/hest.c >> @@ -132,7 +132,7 @@ static bool hest_match_pci(struct acpi_hest_header *hest_hdr, >> return false; >> } >> >> -static int apei_hest_parse(apei_hest_func_t func, void *data) >> +int apei_hest_parse(apei_hest_func_t func, void *data) > > If this is going to exported to the PCI subsystem, I think it needs > some kernel-doc. For example, it's important to know that it stops > parsing the HEST if func returns anything non-zero. This is how > pci_acpi_program_hest_aer_params() knows that it got good data that > matches the device it wants. > > Given the fact that apei_hest_parse_aer() fills in the struct > acpi_hest_parse_aer_info with pointers into the HEST table data, it's > also important to know that this HEST table data is persistent. > Thank you suggestion, and I will consider carefully. Best Regards. LeoLiu-oc >> { >> struct acpi_hest_header *hest_hdr; >> int i, rc, len; >> diff --git a/include/acpi/apei.h b/include/acpi/apei.h >> index 8a0b2b9edbafe..f975e4fe78fcb 100644 >> --- a/include/acpi/apei.h >> +++ b/include/acpi/apei.h >> @@ -37,9 +37,14 @@ typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); >> >> #ifdef CONFIG_ACPI_APEI >> void __init acpi_hest_init(void); >> +int apei_hest_parse(apei_hest_func_t func, void *data); >> int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data); >> #else >> static inline void acpi_hest_init(void) { } >> +static inline int apei_hest_parse(apei_hest_func_t func, void *data) >> +{ >> + return -EINVAL; >> +} >> static inline int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data) >> { >> return -EINVAL; >> -- >> 2.34.1 >>
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index fb839a5c480ee..fd40c035c9b2e 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c @@ -132,7 +132,7 @@ static bool hest_match_pci(struct acpi_hest_header *hest_hdr, return false; } -static int apei_hest_parse(apei_hest_func_t func, void *data) +int apei_hest_parse(apei_hest_func_t func, void *data) { struct acpi_hest_header *hest_hdr; int i, rc, len; diff --git a/include/acpi/apei.h b/include/acpi/apei.h index 8a0b2b9edbafe..f975e4fe78fcb 100644 --- a/include/acpi/apei.h +++ b/include/acpi/apei.h @@ -37,9 +37,14 @@ typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); #ifdef CONFIG_ACPI_APEI void __init acpi_hest_init(void); +int apei_hest_parse(apei_hest_func_t func, void *data); int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data); #else static inline void acpi_hest_init(void) { } +static inline int apei_hest_parse(apei_hest_func_t func, void *data) +{ + return -EINVAL; +} static inline int apei_hest_parse_aer(struct acpi_hest_header *hest_hdr, void *data) { return -EINVAL;