[PATCH 2/5] mfd: da9055: Fix platform device ids to avoid probe failure
From: Bartlomiej Zolnierkiewicz
Date: Fri Mar 20 2015 - 15:02:42 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: Support Opensource <support.opensource@xxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # v3.19+
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
---
drivers/mfd/da9055-core.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index b4d920c..4dbe752 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -298,6 +298,12 @@ static const struct mfd_cell da9055_devs[] = {
{
.of_compatible = "dlg,da9055-gpio",
.name = "da9055-gpio",
+ .id = -1,
+ },
+ {
+ .of_compatible = "dlg,da9055-regulator",
+ .name = "da9055-regulator",
+ .id = 0,
},
{
.of_compatible = "dlg,da9055-regulator",
@@ -327,43 +333,42 @@ static const struct mfd_cell da9055_devs[] = {
{
.of_compatible = "dlg,da9055-regulator",
.name = "da9055-regulator",
- .id = 6,
- },
- {
- .of_compatible = "dlg,da9055-regulator",
- .name = "da9055-regulator",
- .id = 7,
.resources = &da9055_ld05_6_resource,
.num_resources = 1,
+ .id = 6,
},
{
.of_compatible = "dlg,da9055-regulator",
.name = "da9055-regulator",
.resources = &da9055_ld05_6_resource,
.num_resources = 1,
- .id = 8,
+ .id = 7,
},
{
.of_compatible = "dlg,da9055-onkey",
.name = "da9055-onkey",
.resources = &da9055_onkey_resource,
.num_resources = 1,
+ .id = -1,
},
{
.of_compatible = "dlg,da9055-rtc",
.name = "da9055-rtc",
.resources = da9055_rtc_resource,
.num_resources = ARRAY_SIZE(da9055_rtc_resource),
+ .id = -1,
},
{
.of_compatible = "dlg,da9055-hwmon",
.name = "da9055-hwmon",
.resources = &da9055_hwmon_resource,
.num_resources = 1,
+ .id = -1,
},
{
.of_compatible = "dlg,da9055-watchdog",
.name = "da9055-watchdog",
+ .id = -1,
},
};
@@ -404,7 +409,7 @@ int da9055_device_init(struct da9055 *da9055)
da9055->irq_base = regmap_irq_chip_get_base(da9055->irq_data);
- ret = mfd_add_devices(da9055->dev, -1,
+ ret = mfd_add_devices(da9055->dev, 0,
da9055_devs, ARRAY_SIZE(da9055_devs),
NULL, da9055->irq_base, 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/