[PATCH v2 6/8] efi: efivars: Transition to the faux device interface

Sudeep Holla
2025-03-18T17:02:38Z

The "efivars" platform device is created just to enable the efi-pstore
module to autoload based on it. It doesn't have to be platform device
though. 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 this efivars device to
utilize the faux bus, given that the platform device it previously
created was not a real one anyway.

The modalias is retained here as efi-pstore module is dependent on it.

Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/firmware/efi/efi-pstore.c | 2 +-
drivers/firmware/efi/efi.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index a253b61449459eca31afc6ca780a20c4557659ba..eed756a59bba3b5a58cd2e238400c3c12fd5edd5 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -301,4 +301,4 @@ module_exit(efivars_pstore_exit);

MODULE_DESCRIPTION("EFI variable backend for pstore");
MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:efivars");
+MODULE_ALIAS("faux:efivars");
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 862b7744c28ecc9e5a64bbb3533c34119f50267f..dc5c24a7ca540cac342ceddcdbf75b55bf82c889 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -24,7 +24,7 @@
#include <linux/initrd.h>
#include <linux/io.h>
#include <linux/kexec.h>
-#include <linux/platform_device.h>
+#include <linux/device/faux.h>
#include <linux/random.h>
#include <linux/reboot.h>
#include <linux/slab.h>
@@ -443,7 +443,7 @@ static int __init efisubsys_init(void)
error = efivar_ssdt_load();
if (error)
pr_err("efi: failed to load SSDT, error %d.\n", error);
- platform_device_register_simple("efivars", 0, NULL, 0);
+ faux_device_create("efivars", NULL, NULL);
}

BLOCKING_INIT_NOTIFIER_HEAD(&efivar_ops_nh);

--
2.34.1