[PATCH v2 3/5] mfd: lp8788: Fix platform device ids to avoid probe failure
From: Bartlomiej Zolnierkiewicz
Date: Fri Mar 20 2015 - 15:24:02 EST
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.
Fixes: 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
Cc: Johan Hovold <johan@xxxxxxxxxx>
Cc: Milo Kim <milo.kim@xxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
---
stable v3.19+
drivers/mfd/lp8788.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c
index a30bc15..2883b97 100644
--- a/drivers/mfd/lp8788.c
+++ b/drivers/mfd/lp8788.c
@@ -23,6 +23,7 @@
#define MFD_DEV_SIMPLE(_name) \
{ \
.name = LP8788_DEV_##_name, \
+ .id = -1, \
}
#define MFD_DEV_WITH_ID(_name, _id) \
@@ -36,6 +37,7 @@
.name = LP8788_DEV_##_name, \
.resources = _resource, \
.num_resources = num_resource, \
+ .id = -1, \
}
static struct resource chg_irqs[] = {
@@ -73,12 +75,13 @@ static struct resource rtc_irqs[] = {
static const struct mfd_cell lp8788_devs[] = {
/* 4 bucks */
+ MFD_DEV_WITH_ID(BUCK, 0),
MFD_DEV_WITH_ID(BUCK, 1),
MFD_DEV_WITH_ID(BUCK, 2),
MFD_DEV_WITH_ID(BUCK, 3),
- MFD_DEV_WITH_ID(BUCK, 4),
/* 12 digital ldos */
+ MFD_DEV_WITH_ID(DLDO, 0),
MFD_DEV_WITH_ID(DLDO, 1),
MFD_DEV_WITH_ID(DLDO, 2),
MFD_DEV_WITH_ID(DLDO, 3),
@@ -90,9 +93,9 @@ static const struct mfd_cell lp8788_devs[] = {
MFD_DEV_WITH_ID(DLDO, 9),
MFD_DEV_WITH_ID(DLDO, 10),
MFD_DEV_WITH_ID(DLDO, 11),
- MFD_DEV_WITH_ID(DLDO, 12),
/* 10 analog ldos */
+ MFD_DEV_WITH_ID(ALDO, 0),
MFD_DEV_WITH_ID(ALDO, 1),
MFD_DEV_WITH_ID(ALDO, 2),
MFD_DEV_WITH_ID(ALDO, 3),
@@ -102,7 +105,6 @@ static const struct mfd_cell lp8788_devs[] = {
MFD_DEV_WITH_ID(ALDO, 7),
MFD_DEV_WITH_ID(ALDO, 8),
MFD_DEV_WITH_ID(ALDO, 9),
- MFD_DEV_WITH_ID(ALDO, 10),
/* ADC */
MFD_DEV_SIMPLE(ADC),
@@ -199,7 +201,7 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)
if (ret)
return ret;
- return mfd_add_devices(lp->dev, -1, lp8788_devs,
+ return mfd_add_devices(lp->dev, 0, lp8788_devs,
ARRAY_SIZE(lp8788_devs), NULL, 0, NULL);
}
--
1.8.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/