Skip to content

Commit 9b355cd

Browse files
gregkhbp3tk0v
authored andcommitted
x86/microcode: Move away from using a fake platform device
Downloading firmware needs a device to hang off of, and so a platform device seemed like the simplest way to do this. Now that we have a faux device interface, use that instead as this "microcode device" is not anything resembling a platform device at all. Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Sohil Mehta <[email protected]> Link: https://lore.kernel.org/2025070121-omission-small-9308@gregkh
1 parent d7b8f8e commit 9b355cd

File tree

1 file changed

+7
-7
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+7
-7
lines changed

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#define pr_fmt(fmt) "microcode: " fmt
1919

20-
#include <linux/platform_device.h>
2120
#include <linux/stop_machine.h>
21+
#include <linux/device/faux.h>
2222
#include <linux/syscore_ops.h>
2323
#include <linux/miscdevice.h>
2424
#include <linux/capability.h>
@@ -249,7 +249,7 @@ static void reload_early_microcode(unsigned int cpu)
249249
}
250250

251251
/* fake device for request_firmware */
252-
static struct platform_device *microcode_pdev;
252+
static struct faux_device *microcode_fdev;
253253

254254
#ifdef CONFIG_MICROCODE_LATE_LOADING
255255
/*
@@ -690,7 +690,7 @@ static int load_late_locked(void)
690690
if (!setup_cpus())
691691
return -EBUSY;
692692

693-
switch (microcode_ops->request_microcode_fw(0, &microcode_pdev->dev)) {
693+
switch (microcode_ops->request_microcode_fw(0, &microcode_fdev->dev)) {
694694
case UCODE_NEW:
695695
return load_late_stop_cpus(false);
696696
case UCODE_NEW_SAFE:
@@ -841,9 +841,9 @@ static int __init microcode_init(void)
841841
if (early_data.new_rev)
842842
pr_info_once("Updated early from: 0x%08x\n", early_data.old_rev);
843843

844-
microcode_pdev = platform_device_register_simple("microcode", -1, NULL, 0);
845-
if (IS_ERR(microcode_pdev))
846-
return PTR_ERR(microcode_pdev);
844+
microcode_fdev = faux_device_create("microcode", NULL, NULL);
845+
if (!microcode_fdev)
846+
return -ENODEV;
847847

848848
dev_root = bus_get_dev_root(&cpu_subsys);
849849
if (dev_root) {
@@ -862,7 +862,7 @@ static int __init microcode_init(void)
862862
return 0;
863863

864864
out_pdev:
865-
platform_device_unregister(microcode_pdev);
865+
faux_device_destroy(microcode_fdev);
866866
return error;
867867

868868
}

0 commit comments

Comments
 (0)