mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
ACPI: APEI: EINJ: Transition to the faux device interface
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. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Link: https://patch.msgid.link/20250317-plat2faux_dev-v1-8-5fe67c085ad5@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
0af2f6be1b
commit
6cb9441bfe
1 changed files with 11 additions and 21 deletions
|
@ -21,7 +21,7 @@
|
||||||
#include <linux/nmi.h>
|
#include <linux/nmi.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/device/faux.h>
|
||||||
#include <linux/unaligned.h>
|
#include <linux/unaligned.h>
|
||||||
|
|
||||||
#include "apei-internal.h"
|
#include "apei-internal.h"
|
||||||
|
@ -749,7 +749,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init einj_probe(struct platform_device *pdev)
|
static int __init einj_probe(struct faux_device *fdev)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
@ -851,7 +851,7 @@ err_put_table:
|
||||||
return rc;
|
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;
|
struct apei_exec_context ctx;
|
||||||
|
|
||||||
|
@ -872,34 +872,25 @@ static void __exit einj_remove(struct platform_device *pdev)
|
||||||
acpi_put_table((struct acpi_table_header *)einj_tab);
|
acpi_put_table((struct acpi_table_header *)einj_tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_device *einj_dev;
|
static struct faux_device *einj_dev;
|
||||||
/*
|
/*
|
||||||
* einj_remove() lives in .exit.text. For drivers registered via
|
* einj_remove() lives in .exit.text. For drivers registered via
|
||||||
* platform_driver_probe() this is ok because they cannot get unbound at
|
* platform_driver_probe() this is ok because they cannot get unbound at
|
||||||
* runtime. So mark the driver struct with __refdata to prevent modpost
|
* runtime. So mark the driver struct with __refdata to prevent modpost
|
||||||
* triggering a section mismatch warning.
|
* triggering a section mismatch warning.
|
||||||
*/
|
*/
|
||||||
static struct platform_driver einj_driver __refdata = {
|
static struct faux_device_ops einj_device_ops __refdata = {
|
||||||
|
.probe = einj_probe,
|
||||||
.remove = __exit_p(einj_remove),
|
.remove = __exit_p(einj_remove),
|
||||||
.driver = {
|
|
||||||
.name = "acpi-einj",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init einj_init(void)
|
static int __init einj_init(void)
|
||||||
{
|
{
|
||||||
struct platform_device_info einj_dev_info = {
|
einj_dev = faux_device_create("acpi-einj", NULL, &einj_device_ops);
|
||||||
.name = "acpi-einj",
|
if (!einj_dev)
|
||||||
.id = -1,
|
return -ENODEV;
|
||||||
};
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
einj_dev = platform_device_register_full(&einj_dev_info);
|
einj_initialized = true;
|
||||||
if (IS_ERR(einj_dev))
|
|
||||||
return PTR_ERR(einj_dev);
|
|
||||||
|
|
||||||
rc = platform_driver_probe(&einj_driver, einj_probe);
|
|
||||||
einj_initialized = rc == 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -907,9 +898,8 @@ static int __init einj_init(void)
|
||||||
static void __exit einj_exit(void)
|
static void __exit einj_exit(void)
|
||||||
{
|
{
|
||||||
if (einj_initialized)
|
if (einj_initialized)
|
||||||
platform_driver_unregister(&einj_driver);
|
faux_device_destroy(einj_dev);
|
||||||
|
|
||||||
platform_device_unregister(einj_dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(einj_init);
|
module_init(einj_init);
|
||||||
|
|
Loading…
Add table
Reference in a new issue