mfd: Add mfd_clone_cell(), convert cs5535-mfd/olpc-xo1 to it

Replace mfd_shared_platform_driver_register with mfd_clone_cell.  The
former was called by an mfd client, and registered both a platform driver
and device.  The latter is called by an mfd driver, and registers only a
platform device.

The downside of this is that mfd drivers need to be modified whenever
new clients are added that share a cell; the upside is that it fits
Linux's driver model better.  It's also simpler.

This also converts cs5535-mfd/olpc-xo1 from the old API.  cs5535-mfd
now creates the olpc-xo1-{acpi,pms} devices, while olpc-xo1 binds to
them via platform drivers.

Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Andres Salomon
2011-03-21 19:19:35 -07:00
committed by Samuel Ortiz
parent 16c29dafcc
commit fa1df69168
4 changed files with 53 additions and 58 deletions

View File

@@ -121,22 +121,21 @@ static int __init olpc_xo1_init(void)
{
int r;
r = mfd_shared_platform_driver_register(&cs5535_pms_drv, "cs5535-pms");
r = platform_driver_register(&cs5535_pms_drv);
if (r)
return r;
r = mfd_shared_platform_driver_register(&cs5535_acpi_drv,
"cs5535-acpi");
r = platform_driver_register(&cs5535_acpi_drv);
if (r)
mfd_shared_platform_driver_unregister(&cs5535_pms_drv);
platform_driver_unregister(&cs5535_pms_drv);
return r;
}
static void __exit olpc_xo1_exit(void)
{
mfd_shared_platform_driver_unregister(&cs5535_acpi_drv);
mfd_shared_platform_driver_unregister(&cs5535_pms_drv);
platform_driver_unregister(&cs5535_acpi_drv);
platform_driver_unregister(&cs5535_pms_drv);
}
MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>");