Skip to content

Commit af5376a

Browse files
sudeep-hollarafaeljw
authored andcommitted
cpuidle: psci: Transition to the faux device interface
The PSCI cpuidle 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-1-5fe67c085ad5@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent d4a7882 commit af5376a

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

drivers/cpuidle/cpuidle-psci.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/kernel.h>
1717
#include <linux/module.h>
1818
#include <linux/of.h>
19-
#include <linux/platform_device.h>
19+
#include <linux/device/faux.h>
2020
#include <linux/psci.h>
2121
#include <linux/pm_domain.h>
2222
#include <linux/pm_runtime.h>
@@ -407,14 +407,14 @@ static int psci_idle_init_cpu(struct device *dev, int cpu)
407407
* to register cpuidle driver then rollback to cancel all CPUs
408408
* registration.
409409
*/
410-
static int psci_cpuidle_probe(struct platform_device *pdev)
410+
static int psci_cpuidle_probe(struct faux_device *fdev)
411411
{
412412
int cpu, ret;
413413
struct cpuidle_driver *drv;
414414
struct cpuidle_device *dev;
415415

416416
for_each_present_cpu(cpu) {
417-
ret = psci_idle_init_cpu(&pdev->dev, cpu);
417+
ret = psci_idle_init_cpu(&fdev->dev, cpu);
418418
if (ret)
419419
goto out_fail;
420420
}
@@ -434,26 +434,18 @@ static int psci_cpuidle_probe(struct platform_device *pdev)
434434
return ret;
435435
}
436436

437-
static struct platform_driver psci_cpuidle_driver = {
437+
static struct faux_device_ops psci_cpuidle_ops = {
438438
.probe = psci_cpuidle_probe,
439-
.driver = {
440-
.name = "psci-cpuidle",
441-
},
442439
};
443440

444441
static int __init psci_idle_init(void)
445442
{
446-
struct platform_device *pdev;
447-
int ret;
443+
struct faux_device *fdev;
448444

449-
ret = platform_driver_register(&psci_cpuidle_driver);
450-
if (ret)
451-
return ret;
452-
453-
pdev = platform_device_register_simple("psci-cpuidle", -1, NULL, 0);
454-
if (IS_ERR(pdev)) {
455-
platform_driver_unregister(&psci_cpuidle_driver);
456-
return PTR_ERR(pdev);
445+
fdev = faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops);
446+
if (!fdev) {
447+
pr_err("Failed to create psci-cpuidle device\n");
448+
return -ENODEV;
457449
}
458450

459451
return 0;

0 commit comments

Comments
 (0)