From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Ben Cheatham <Benjamin.Cheatham@amd.com>
Cc: <dan.j.williams@intel.com>, <dave@stogolabs.net>,
<dave.jiang@intel.com>, <alison.schofield@intel.com>,
<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
<rafael@kernel.org>, <linux-cxl@vger.kernel.org>,
<linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v11 2/4] EINJ: Migrate to a platform driver
Date: Wed, 14 Feb 2024 14:37:32 +0000 [thread overview]
Message-ID: <20240214143732.000068b5@Huawei.com> (raw)
In-Reply-To: <20240208200042.432958-3-Benjamin.Cheatham@amd.com>
On Thu, 8 Feb 2024 14:00:40 -0600
Ben Cheatham <Benjamin.Cheatham@amd.com> wrote:
> Change the EINJ module to install a platform device/driver on module
> init and move the module init() and exit() functions to driver probe and
> remove. This change allows the EINJ module to load regardless of whether
> setting up EINJ succeeds, which allows dependent modules to still load
> (i.e. the CXL core).
>
> Since EINJ may no longer be initialized when the module loads, any
> functions that are called from dependent/external modules should check
> the einj_initialized variable before calling any EINJ functions.
>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
As there is not a platform device about, could reduce the number of globals
in here, but job for another day.
Also devm fun might be useful to reduce the need for manual error handling
and remove().
So generally this enables some potential tidying up, but what you have
here LGTM and would be first step in that process anyway.
If I run out of other stuff to do (unlikely ;) then I might take a stab
at such a cleanup sometime.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/acpi/apei/einj.c | 44 ++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
> index 013eb621dc92..73dde21d3e89 100644
> --- a/drivers/acpi/apei/einj.c
> +++ b/drivers/acpi/apei/einj.c
> @@ -21,6 +21,7 @@
> #include <linux/nmi.h>
> #include <linux/delay.h>
> #include <linux/mm.h>
> +#include <linux/platform_device.h>
> #include <asm/unaligned.h>
>
> #include "apei-internal.h"
> @@ -136,6 +137,11 @@ static struct apei_exec_ins_type einj_ins_type[] = {
> */
> static DEFINE_MUTEX(einj_mutex);
>
> +/*
> + * Exported APIs use this flag to exit early if einj_probe() failed.
> + */
> +static bool einj_initialized __ro_after_init;
> +
> static void *einj_param;
>
> static void einj_exec_ctx_init(struct apei_exec_context *ctx)
> @@ -684,7 +690,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab)
> return 0;
> }
>
> -static int __init einj_init(void)
> +static int __init einj_probe(struct platform_device *pdev)
> {
> int rc;
> acpi_status status;
> @@ -782,7 +788,7 @@ static int __init einj_init(void)
> return rc;
> }
>
> -static void __exit einj_exit(void)
> +static void __exit einj_remove(struct platform_device *pdev)
> {
> struct apei_exec_context ctx;
>
> @@ -801,6 +807,40 @@ static void __exit einj_exit(void)
> acpi_put_table((struct acpi_table_header *)einj_tab);
> }
next prev parent reply other threads:[~2024-02-14 14:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 20:00 [PATCH v11 0/4] CXL, ACPI, APEI, EINJ: Update EINJ for CXL error types Ben Cheatham
2024-02-08 20:00 ` [PATCH v11 1/4] cxl, ACPI, APEI, EINJ: Add CXL_EINJ Kconfig option Ben Cheatham
2024-02-14 14:05 ` Jonathan Cameron
2024-02-14 14:34 ` Ben Cheatham
2024-02-08 20:00 ` [PATCH v11 2/4] EINJ: Migrate to a platform driver Ben Cheatham
2024-02-14 14:37 ` Jonathan Cameron [this message]
2024-02-08 20:00 ` [PATCH v11 3/4] cxl/core, EINJ: Add EINJ CXL debugfs files and EINJ helper functions Ben Cheatham
2024-02-09 21:30 ` Ben Cheatham
2024-02-10 0:02 ` Dan Williams
2024-02-10 6:31 ` Dan Williams
2024-02-12 14:12 ` Ben Cheatham
2024-02-13 17:29 ` Ben Cheatham
2024-02-13 18:08 ` Dan Williams
2024-02-14 15:27 ` Jonathan Cameron
2024-02-14 16:41 ` Ben Cheatham
2024-02-14 17:46 ` Jonathan Cameron
2024-02-14 17:54 ` Ben Cheatham
2024-02-08 20:00 ` [PATCH v11 4/4] EINJ, Documentation: Update EINJ kernel doc Ben Cheatham
2024-02-14 15:29 ` Jonathan Cameron
2024-02-11 1:15 ` [PATCH v11 0/4] CXL, ACPI, APEI, EINJ: Update EINJ for CXL error types Dan Williams
2024-02-12 14:13 ` Ben Cheatham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240214143732.000068b5@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Benjamin.Cheatham@amd.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stogolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox