[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jV1iHiq_2oNWDja0deQy0JDVp9-R=qi3GeivbY7rSo1A@mail.gmail.com>
Date: Wed, 9 Apr 2025 20:18:34 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Sudeep Holla <sudeep.holla@....com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Borislav Petkov <bp@...en8.de>, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v2 7/8] ACPI: APEI: EINJ: Transition to the faux device interface
On Tue, Mar 18, 2025 at 6:02 PM Sudeep Holla <sudeep.holla@....com> wrote:
>
> The APEI error injection driver does not require the creation of a
> platform device. Originally, this approach was chosen for simplicity
> when the driver was first implemented.
>
> With the introduction of the lightweight faux device interface, we now
> have a more appropriate alternative. Migrate the driver to utilize the
> faux bus, given that the platform device it previously created was not
> a real one anyway. This will simplify the code, reducing its footprint
> while maintaining functionality.
>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: linux-acpi@...r.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
This causes 0-day to complain when applied on top of 6.15-rc1:
https://lore.kernel.org/linux-acpi/202504100128.AjbVDQgK-lkp@intel.com/
> ---
> drivers/acpi/apei/einj-core.c | 51 +++++--------------------------------------
> 1 file changed, 6 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
> index 04731a5b01faaba534bad853d0acc4c8a873a53b..5fddd01074bafab2f7b23fd7ef9f863c0856637b 100644
> --- a/drivers/acpi/apei/einj-core.c
> +++ b/drivers/acpi/apei/einj-core.c
> @@ -21,7 +21,7 @@
> #include <linux/nmi.h>
> #include <linux/delay.h>
> #include <linux/mm.h>
> -#include <linux/platform_device.h>
> +#include <linux/device/faux.h>
> #include <linux/unaligned.h>
>
> #include "apei-internal.h"
> @@ -749,7 +749,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab)
> return 0;
> }
>
> -static int __init einj_probe(struct platform_device *pdev)
> +static int __init einj_probe(struct faux_device *fdev)
> {
> int rc;
> acpi_status status;
> @@ -838,6 +838,8 @@ static int __init einj_probe(struct platform_device *pdev)
>
> pr_info("Error INJection is initialized.\n");
>
> + einj_initialized = true;
> +
> return 0;
>
> err_release:
> @@ -851,7 +853,7 @@ static int __init einj_probe(struct platform_device *pdev)
> return rc;
> }
>
> -static void __exit einj_remove(struct platform_device *pdev)
> +static void __exit einj_remove(struct faux_device *fdev)
> {
> struct apei_exec_context ctx;
>
> @@ -872,48 +874,7 @@ static void __exit einj_remove(struct platform_device *pdev)
> acpi_put_table((struct acpi_table_header *)einj_tab);
> }
>
> -static struct platform_device *einj_dev;
> -/*
> - * einj_remove() lives in .exit.text. For drivers registered via
> - * platform_driver_probe() this is ok because they cannot get unbound at
> - * runtime. So mark the driver struct with __refdata to prevent modpost
> - * triggering a section mismatch warning.
> - */
> -static struct platform_driver einj_driver __refdata = {
> - .remove = __exit_p(einj_remove),
> - .driver = {
> - .name = "acpi-einj",
> - },
> -};
> -
> -static int __init einj_init(void)
> -{
> - struct platform_device_info einj_dev_info = {
> - .name = "acpi-einj",
> - .id = -1,
> - };
> - int rc;
> -
> - einj_dev = platform_device_register_full(&einj_dev_info);
> - if (IS_ERR(einj_dev))
> - return PTR_ERR(einj_dev);
> -
> - rc = platform_driver_probe(&einj_driver, einj_probe);
> - einj_initialized = rc == 0;
> -
> - return 0;
> -}
> -
> -static void __exit einj_exit(void)
> -{
> - if (einj_initialized)
> - platform_driver_unregister(&einj_driver);
> -
> - platform_device_unregister(einj_dev);
> -}
> -
> -module_init(einj_init);
> -module_exit(einj_exit);
> +module_faux_driver(acpi_einj, einj_probe, __exit_p(einj_remove), true);
>
> MODULE_AUTHOR("Huang Ying");
> MODULE_DESCRIPTION("APEI Error INJection support");
>
> --
> 2.34.1
>
>
Powered by blists - more mailing lists