1
0
Fork 0

cpuidle: mvebu: clean up multiple platform drivers

There's no need to use multiple platform drivers, especially when we
want to do something different in the probe, but we still use a common
probe function.

We can use the platform ID system to only register one platform driver,
but have it match several devices, and give us the CPU idle driver via
the ID's driver_data.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
hifive-unleashed-5.1
Russell King 2015-10-03 00:24:25 +01:00 committed by Daniel Lezcano
parent 7379047d55
commit da1a64f80d
1 changed files with 23 additions and 28 deletions

View File

@ -99,44 +99,39 @@ static struct cpuidle_driver armada38x_idle_driver = {
static int mvebu_v7_cpuidle_probe(struct platform_device *pdev)
{
const struct platform_device_id *id = pdev->id_entry;
if (!id)
return -EINVAL;
mvebu_v7_cpu_suspend = pdev->dev.platform_data;
if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-xp"))
return cpuidle_register(&armadaxp_idle_driver, NULL);
else if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-370"))
return cpuidle_register(&armada370_idle_driver, NULL);
else if (!strcmp(pdev->dev.driver->name, "cpuidle-armada-38x"))
return cpuidle_register(&armada38x_idle_driver, NULL);
else
return -EINVAL;
return cpuidle_register((struct cpuidle_driver *)id->driver_data, NULL);
}
static struct platform_driver armadaxp_cpuidle_plat_driver = {
.driver = {
static const struct platform_device_id mvebu_cpuidle_ids[] = {
{
.name = "cpuidle-armada-xp",
},
.probe = mvebu_v7_cpuidle_probe,
};
module_platform_driver(armadaxp_cpuidle_plat_driver);
static struct platform_driver armada370_cpuidle_plat_driver = {
.driver = {
.driver_data = (unsigned long)&armadaxp_idle_driver,
}, {
.name = "cpuidle-armada-370",
},
.probe = mvebu_v7_cpuidle_probe,
};
module_platform_driver(armada370_cpuidle_plat_driver);
static struct platform_driver armada38x_cpuidle_plat_driver = {
.driver = {
.driver_data = (unsigned long)&armada370_idle_driver,
}, {
.name = "cpuidle-armada-38x",
.driver_data = (unsigned long)&armada38x_idle_driver,
},
.probe = mvebu_v7_cpuidle_probe,
{}
};
module_platform_driver(armada38x_cpuidle_plat_driver);
static struct platform_driver mvebu_cpuidle_driver = {
.probe = mvebu_v7_cpuidle_probe,
.driver = {
.name = "cpuidle-mbevu",
},
.id_table = mvebu_cpuidle_ids,
};
module_platform_driver(mvebu_cpuidle_driver);
MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
MODULE_DESCRIPTION("Marvell EBU v7 cpuidle driver");