Commit 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
changed the way platform device ids are generated from mfd id base and
cell ids in mfd_add_device().  Unfortunately the change in question
breaks mfd drivers which are using mfd_add_devices() with mfd id base
equal to -1 and non-zero cell ids (used to distinguish cells with
the same name field).  The result is that mfd core tries to register
platform devices with the same name which obviously fails and leads
to mfd device probe failure.

Changing mfd_add_devices() mfd id base from -1 to 0 and at the same
time setting proper cell ids for all cells fixes the issue.

In case of da9052 mfd driver the issue has already been fixed by
commit b3f6c73db732 ("mfd: da9052-core: Fix platform-device id
collision").  Unfortunately as the fix makes auto devid generation
to be used for all mfd platform devices it causes unneccessary change
of platform device names.  Fix the driver to use the original names.

Cc: Johan Hovold <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Support Opensource <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
---
 drivers/mfd/da9052-core.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index ae498b5..77d41ad 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp);
 static const struct mfd_cell da9052_subdev_info[] = {
        {
                .name = "da9052-regulator",
+               .id = 0,
+       },
+       {
+               .name = "da9052-regulator",
                .id = 1,
        },
        {
@@ -484,41 +488,48 @@ static const struct mfd_cell da9052_subdev_info[] = {
                .id = 13,
        },
        {
-               .name = "da9052-regulator",
-               .id = 14,
-       },
-       {
                .name = "da9052-onkey",
+               .id = -1,
        },
        {
                .name = "da9052-rtc",
+               .id = -1,
        },
        {
                .name = "da9052-gpio",
+               .id = -1,
        },
        {
                .name = "da9052-hwmon",
+               .id = -1,
        },
        {
                .name = "da9052-leds",
+               .id = -1,
        },
        {
                .name = "da9052-wled1",
+               .id = -1,
        },
        {
                .name = "da9052-wled2",
+               .id = -1,
        },
        {
                .name = "da9052-wled3",
+               .id = -1,
        },
        {
                .name = "da9052-tsi",
+               .id = -1,
        },
        {
                .name = "da9052-bat",
+               .id = -1,
        },
        {
                .name = "da9052-watchdog",
+               .id = -1,
        },
 };
 
@@ -554,7 +565,7 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
                return ret;
        }
 
-       ret = mfd_add_devices(da9052->dev, PLATFORM_DEVID_AUTO,
+       ret = mfd_add_devices(da9052->dev, 0,
                              da9052_subdev_info,
                              ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL);
        if (ret) {
-- 
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to