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. Change mfd_add_devices() mfd id base from -1 to PLATFORM_DEVID_AUTO to fix the issue. Fixes: 6e3f62f0793e ("mfd: core: Fix platform-device id generation") Cc: Johan Hovold <johan@xxxxxxxxxx> Cc: patches@xxxxxxxxxxxxxxxxxxxxxxxxxxx Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> --- drivers/mfd/wm831x-core.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 28366a9..6ad88f6 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -1619,9 +1619,8 @@ EXPORT_SYMBOL_GPL(wm831x_regmap_config); int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) { struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev); - int rev, wm831x_num; + int ret, rev, i; enum wm831x_parent parent; - int ret, i; mutex_init(&wm831x->io_lock); mutex_init(&wm831x->key_lock); @@ -1770,12 +1769,6 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) } } - /* Multiply by 10 as we have many subdevices of the same type */ - if (pdata && pdata->wm831x_num) - wm831x_num = pdata->wm831x_num * 10; - else - wm831x_num = -1; - ret = wm831x_irq_init(wm831x, irq); if (ret != 0) goto err; @@ -1785,27 +1778,27 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) /* The core device is up, instantiate the subdevices. */ switch (parent) { case WM8310: - ret = mfd_add_devices(wm831x->dev, wm831x_num, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, wm8310_devs, ARRAY_SIZE(wm8310_devs), NULL, 0, NULL); break; case WM8311: - ret = mfd_add_devices(wm831x->dev, wm831x_num, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, wm8311_devs, ARRAY_SIZE(wm8311_devs), NULL, 0, NULL); if (!pdata || !pdata->disable_touch) - mfd_add_devices(wm831x->dev, wm831x_num, + mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, touch_devs, ARRAY_SIZE(touch_devs), NULL, 0, NULL); break; case WM8312: - ret = mfd_add_devices(wm831x->dev, wm831x_num, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, wm8312_devs, ARRAY_SIZE(wm8312_devs), NULL, 0, NULL); if (!pdata || !pdata->disable_touch) - mfd_add_devices(wm831x->dev, wm831x_num, + mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, touch_devs, ARRAY_SIZE(touch_devs), NULL, 0, NULL); break; @@ -1814,7 +1807,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) case WM8321: case WM8325: case WM8326: - ret = mfd_add_devices(wm831x->dev, wm831x_num, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, wm8320_devs, ARRAY_SIZE(wm8320_devs), NULL, 0, NULL); break; @@ -1839,7 +1832,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) } if (ret & WM831X_XTAL_ENA) { - ret = mfd_add_devices(wm831x->dev, wm831x_num, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, rtc_devs, ARRAY_SIZE(rtc_devs), NULL, 0, NULL); if (ret != 0) { @@ -1852,7 +1845,8 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) if (pdata && pdata->backlight) { /* Treat errors as non-critical */ - ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, + ret = mfd_add_devices(wm831x->dev, PLATFORM_DEVID_AUTO, + backlight_devs, ARRAY_SIZE(backlight_devs), NULL, 0, NULL); if (ret < 0) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html