Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp463309imm; Thu, 31 May 2018 03:53:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK6WtbjQ+o/OMPmsEpJyFJZsi0SPGXWtoxY7qEsH8693YpnEXMTph548ojJAatbi0eizA0n X-Received: by 2002:a17:902:7e42:: with SMTP id a2-v6mr6494882pln.151.1527764035784; Thu, 31 May 2018 03:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527764035; cv=none; d=google.com; s=arc-20160816; b=PG8KOsfP0SNv+WJORMWKOEWaSVBxkHYAghYVM4xRLHYNe0hhpGGCJDogdbaPl3jf1w Vg0C/qfoPE1PyMbCZ8KHPM20guz/VWx2sooOsEghejKvVXb2g+I9qx3E1kAzGH6gn0DG CI5iULGO6dDPCpOus22c/0NeYdcfoWscltnGVpwyhMmtoG/FoagBZZw8DVaxPj0ALPH4 ywDKHcKW4vROmJRjnpRuGEk8ghRngVD9O65q7KUDqcBnNVod+FXeEBSBLe99s5BYylaw 012zGL7zpRAfVYAg5KBgE1E0N0hT3Y/lr6hBH4ma8sYz/fLkbvoZ40qJKNE2bLVMUklZ CXfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=GVVG4hpMh2fxOARai2Wy6R6k8MxXoK6wli5EjxakwaU=; b=zcC/IP99agC/oqrtVXKT60bsbe+MSvPdYg2oqzyzIvzJUW5F1EmlgQoGrD+TYM5ilz CmeXdYvCQWjEQNe+NkcnIeXwGOSb8s+jYothYfIl5wXEjPNlGOHvx4rAiK0azPQUI+AQ /7N7Ws85FNLIgfFYOX/o+q57zcp7MKDznGFnpKnLQEqJXwyH46/SUnmXFWvSGvPFqtkK cQJ55GFrzcN/DeyruF4iGjY4wpQ3dgeKK8otz32E9DOxmtS+YPzST2qRxZlE6/DOLZ6S wCDLGLAA8+4dW88oIbd3F/4BfJI8/f77C609AS1z8l0Luzli6HV3gV4HKNef4AI8p3Ir uEHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si5429625pgp.345.2018.05.31.03.53.41; Thu, 31 May 2018 03:53:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754605AbeEaKw7 (ORCPT + 99 others); Thu, 31 May 2018 06:52:59 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39632 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754464AbeEaKw5 (ORCPT ); Thu, 31 May 2018 06:52:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 77E941529; Thu, 31 May 2018 03:52:57 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F0AC93F24A; Thu, 31 May 2018 03:52:54 -0700 (PDT) Date: Thu, 31 May 2018 11:52:52 +0100 From: Mark Rutland To: Dongjiu Geng Cc: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, tony.luck@intel.com, bp@alien8.de, robert.moore@intel.com, erik.schmauss@intel.com, dave.martin@arm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH v1 1/2] ACPI / APEI: Add SEI notification type support for ARMv8 Message-ID: <20180531105252.it67drvnsfz62pqa@lakrids.cambridge.arm.com> References: <1527770506-8076-1-git-send-email-gengdongjiu@huawei.com> <1527770506-8076-2-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527770506-8076-2-git-send-email-gengdongjiu@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 08:41:45PM +0800, Dongjiu Geng wrote: > +#ifdef CONFIG_ACPI_APEI_SEI > +static LIST_HEAD(ghes_sei); > + > +/* > + * Return 0 only if one of the SEI error sources successfully reported an error > + * record sent from the firmware. > + */ > +int ghes_notify_sei(void) > +{ > + struct ghes *ghes; > + int ret = -ENOENT; > + > + rcu_read_lock(); > + list_for_each_entry_rcu(ghes, &ghes_sei, list) { > + if (!ghes_proc(ghes)) > + ret = 0; > + } > + rcu_read_unlock(); > + return ret; > +} > + > +static void ghes_sei_add(struct ghes *ghes) > +{ > + mutex_lock(&ghes_list_mutex); > + list_add_rcu(&ghes->list, &ghes_sei); > + mutex_unlock(&ghes_list_mutex); > +} > + > +static void ghes_sei_remove(struct ghes *ghes) > +{ > + mutex_lock(&ghes_list_mutex); > + list_del_rcu(&ghes->list); > + mutex_unlock(&ghes_list_mutex); > + synchronize_rcu(); > +} > +#else /* CONFIG_ACPI_APEI_SEI */ > +static inline void ghes_sei_add(struct ghes *ghes) { } > +static inline void ghes_sei_remove(struct ghes *ghes) { } > +#endif /* CONFIG_ACPI_APEI_SEI */ > + > #ifdef CONFIG_HAVE_ACPI_APEI_NMI > /* > index 8feb0c8..9ba59e2 100644 > --- a/include/acpi/ghes.h > +++ b/include/acpi/ghes.h > @@ -120,5 +120,6 @@ static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata) > section = acpi_hest_get_next(section)) > > int ghes_notify_sea(void); > +int ghes_notify_sei(void); It would be nice to have a stub definition when !CONFIG_ACPI_APEI_SEI, e.g. #ifdef CONFIG_ACPI_APEI_SEI int ghes_notify_sei(void); #else static in int ghes_notify_sei(void) { return -ENOENT; } #endif ... as callers could simply call this without additional checks. As a cleanup, similar would be nice for ghes_notify_sea() with CONFIG_ACPI_APEI_SEA. Thanks, Mark.