mfd: Allow multiple MFD cells with the same name
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 27 Jul 2009 13:45:51 +0000 (14:45 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 17 Sep 2009 07:46:56 +0000 (09:46 +0200)
Provide basic support for MFDs having multiple cells of a given
type with different IDs by adding an id to the mfd_cell structure
and then adding that to the id passed in to mfd_add_devices().

As it stands this approach requires that MFDs using this feature
deal with ensuring that there aren't any ID collisions resulting
from multiple MFDs of the same type being instantiated. This needs
to happen with the existing code too, but with this approach there
is a knock on effect on the IDs for non-duplicated devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/mfd-core.c
include/linux/mfd/core.h

index 54ddf3772e0c104c29e9d98da29e22eb7c300220..ae15e495e20ea86591b7a5bf03d261ecd504d6d7 100644 (file)
@@ -25,7 +25,7 @@ static int mfd_add_device(struct device *parent, int id,
        int ret = -ENOMEM;
        int r;
 
-       pdev = platform_device_alloc(cell->name, id);
+       pdev = platform_device_alloc(cell->name, id + cell->id);
        if (!pdev)
                goto fail_alloc;
 
index 49ef857cdb2dc63d6001b843587d742bff17092a..11d740b8831d6fa4559a2b758ff2e1f8f9695fd5 100644 (file)
@@ -23,6 +23,7 @@
  */
 struct mfd_cell {
        const char              *name;
+       int                     id;
 
        int                     (*enable)(struct platform_device *dev);
        int                     (*disable)(struct platform_device *dev);
This page took 0.029023 seconds and 5 git commands to generate.