]> git.itanic.dy.fi Git - linux-stable/commitdiff
mfd: core: Fix platform-device name collisions
authorJohan Hovold <johan@kernel.org>
Wed, 25 Mar 2015 11:07:05 +0000 (12:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2015 20:01:52 +0000 (22:01 +0200)
commit a77c50b44cfb663ad03faba9800fec19bdf83577 upstream.

Since commit 6e3f62f0793e ("mfd: core: Fix platform-device id
generation") we honour PLATFORM_DEVID_AUTO and PLATFORM_DEVID_NONE when
registering mfd-devices.

Unfortunately, some mfd-drivers rely on the old behaviour of generating
platform-device ids by adding the cell id also to the special value of
PLATFORM_DEVID_NONE. The resulting platform ids are not only used to
generate device-unique names, but are also used instead of the cell id
to identify cells when probing subdevices.

These drivers should be updated to use PLATFORM_DEVID_AUTO, which would
also allow more than one device to be registered without resorting to
hacks (see for example wm831x), but lets fix the regression first by
partially reverting the above mentioned commit with respect to
PLATFORM_DEVID_NONE.

Fixes: 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mfd/mfd-core.c

index 2a87f69be53db0a4ca1951fd7cbc3d7733e44007..1aed3b7b8d9be1e965904a0cd4f7923a2310de2e 100644 (file)
@@ -128,7 +128,7 @@ static int mfd_add_device(struct device *parent, int id,
        int platform_id;
        int r;
 
-       if (id < 0)
+       if (id == PLATFORM_DEVID_AUTO)
                platform_id = id;
        else
                platform_id = id + cell->id;