[PATCH v2 4/5] mfd: wm831x: Fix platform device ids to avoid probe failure
From: Bartlomiej Zolnierkiewicz
Date: Fri Mar 20 2015 - 15:24:11 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: patches@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
---
stable v3.19+
drivers/mfd/wm831x-core.c | 184 +++++++++++++++++++++++++++-------------------
1 file changed, 107 insertions(+), 77 deletions(-)
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 28366a9..68a7543 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1014,152 +1014,159 @@ static struct resource wm831x_wdt_resources[] = {
static const struct mfd_cell wm8310_devs[] = {
{
.name = "wm831x-backup",
+ .id = -1,
},
{
.name = "wm831x-buckv",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
.resources = wm831x_dcdc1_resources,
},
{
.name = "wm831x-buckv",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
.resources = wm831x_dcdc2_resources,
},
{
.name = "wm831x-buckp",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
.resources = wm831x_dcdc3_resources,
},
{
.name = "wm831x-boostp",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_dcdc4_resources),
.resources = wm831x_dcdc4_resources,
},
{
.name = "wm831x-clk",
+ .id = -1,
},
{
.name = "wm831x-epe",
- .id = 1,
+ .id = 0,
},
{
.name = "wm831x-epe",
- .id = 2,
+ .id = 1,
},
{
.name = "wm831x-gpio",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_gpio_resources),
.resources = wm831x_gpio_resources,
},
{
.name = "wm831x-hwmon",
+ .id = -1,
},
{
.name = "wm831x-isink",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_isink1_resources),
.resources = wm831x_isink1_resources,
},
{
.name = "wm831x-isink",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_isink2_resources),
.resources = wm831x_isink2_resources,
},
{
.name = "wm831x-ldo",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
.resources = wm831x_ldo1_resources,
},
{
.name = "wm831x-ldo",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
.resources = wm831x_ldo2_resources,
},
{
.name = "wm831x-ldo",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
.resources = wm831x_ldo3_resources,
},
{
.name = "wm831x-ldo",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
.resources = wm831x_ldo4_resources,
},
{
.name = "wm831x-ldo",
- .id = 5,
+ .id = 4,
.num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
.resources = wm831x_ldo5_resources,
},
{
.name = "wm831x-ldo",
- .id = 6,
+ .id = 5,
.num_resources = ARRAY_SIZE(wm831x_ldo6_resources),
.resources = wm831x_ldo6_resources,
},
{
.name = "wm831x-aldo",
- .id = 7,
+ .id = 6,
.num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
.resources = wm831x_ldo7_resources,
},
{
.name = "wm831x-aldo",
- .id = 8,
+ .id = 7,
.num_resources = ARRAY_SIZE(wm831x_ldo8_resources),
.resources = wm831x_ldo8_resources,
},
{
.name = "wm831x-aldo",
- .id = 9,
+ .id = 8,
.num_resources = ARRAY_SIZE(wm831x_ldo9_resources),
.resources = wm831x_ldo9_resources,
},
{
.name = "wm831x-aldo",
- .id = 10,
+ .id = 9,
.num_resources = ARRAY_SIZE(wm831x_ldo10_resources),
.resources = wm831x_ldo10_resources,
},
{
.name = "wm831x-alive-ldo",
- .id = 11,
+ .id = 10,
.num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
.resources = wm831x_ldo11_resources,
},
{
.name = "wm831x-on",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_on_resources),
.resources = wm831x_on_resources,
},
{
.name = "wm831x-power",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_power_resources),
.resources = wm831x_power_resources,
},
{
.name = "wm831x-status",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_status1_resources),
.resources = wm831x_status1_resources,
},
{
.name = "wm831x-status",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_status2_resources),
.resources = wm831x_status2_resources,
},
{
.name = "wm831x-watchdog",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
.resources = wm831x_wdt_resources,
},
@@ -1168,128 +1175,135 @@ static const struct mfd_cell wm8310_devs[] = {
static const struct mfd_cell wm8311_devs[] = {
{
.name = "wm831x-backup",
+ .id = -1,
},
{
.name = "wm831x-buckv",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
.resources = wm831x_dcdc1_resources,
},
{
.name = "wm831x-buckv",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
.resources = wm831x_dcdc2_resources,
},
{
.name = "wm831x-buckp",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
.resources = wm831x_dcdc3_resources,
},
{
.name = "wm831x-boostp",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_dcdc4_resources),
.resources = wm831x_dcdc4_resources,
},
{
.name = "wm831x-clk",
+ .id = -1,
},
{
.name = "wm831x-epe",
- .id = 1,
+ .id = 0,
},
{
.name = "wm831x-epe",
- .id = 2,
+ .id = 1,
},
{
.name = "wm831x-gpio",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_gpio_resources),
.resources = wm831x_gpio_resources,
},
{
.name = "wm831x-hwmon",
+ .id = -1,
},
{
.name = "wm831x-isink",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_isink1_resources),
.resources = wm831x_isink1_resources,
},
{
.name = "wm831x-isink",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_isink2_resources),
.resources = wm831x_isink2_resources,
},
{
.name = "wm831x-ldo",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
.resources = wm831x_ldo1_resources,
},
{
.name = "wm831x-ldo",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
.resources = wm831x_ldo2_resources,
},
{
.name = "wm831x-ldo",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
.resources = wm831x_ldo3_resources,
},
{
.name = "wm831x-ldo",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
.resources = wm831x_ldo4_resources,
},
{
.name = "wm831x-ldo",
- .id = 5,
+ .id = 4,
.num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
.resources = wm831x_ldo5_resources,
},
{
.name = "wm831x-aldo",
- .id = 7,
+ .id = 6,
.num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
.resources = wm831x_ldo7_resources,
},
{
.name = "wm831x-alive-ldo",
- .id = 11,
+ .id = 10,
.num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
.resources = wm831x_ldo11_resources,
},
{
.name = "wm831x-on",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_on_resources),
.resources = wm831x_on_resources,
},
{
.name = "wm831x-power",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_power_resources),
.resources = wm831x_power_resources,
},
{
.name = "wm831x-status",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_status1_resources),
.resources = wm831x_status1_resources,
},
{
.name = "wm831x-status",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_status2_resources),
.resources = wm831x_status2_resources,
},
{
.name = "wm831x-watchdog",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
.resources = wm831x_wdt_resources,
},
@@ -1298,152 +1312,159 @@ static const struct mfd_cell wm8311_devs[] = {
static const struct mfd_cell wm8312_devs[] = {
{
.name = "wm831x-backup",
+ .id = -1,
},
{
.name = "wm831x-buckv",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
.resources = wm831x_dcdc1_resources,
},
{
.name = "wm831x-buckv",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
.resources = wm831x_dcdc2_resources,
},
{
.name = "wm831x-buckp",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
.resources = wm831x_dcdc3_resources,
},
{
.name = "wm831x-boostp",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_dcdc4_resources),
.resources = wm831x_dcdc4_resources,
},
{
.name = "wm831x-clk",
+ .id = -1,
},
{
.name = "wm831x-epe",
- .id = 1,
+ .id = 0,
},
{
.name = "wm831x-epe",
- .id = 2,
+ .id = 1,
},
{
.name = "wm831x-gpio",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_gpio_resources),
.resources = wm831x_gpio_resources,
},
{
.name = "wm831x-hwmon",
+ .id = -1,
},
{
.name = "wm831x-isink",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_isink1_resources),
.resources = wm831x_isink1_resources,
},
{
.name = "wm831x-isink",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_isink2_resources),
.resources = wm831x_isink2_resources,
},
{
.name = "wm831x-ldo",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
.resources = wm831x_ldo1_resources,
},
{
.name = "wm831x-ldo",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
.resources = wm831x_ldo2_resources,
},
{
.name = "wm831x-ldo",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
.resources = wm831x_ldo3_resources,
},
{
.name = "wm831x-ldo",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
.resources = wm831x_ldo4_resources,
},
{
.name = "wm831x-ldo",
- .id = 5,
+ .id = 4,
.num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
.resources = wm831x_ldo5_resources,
},
{
.name = "wm831x-ldo",
- .id = 6,
+ .id = 5,
.num_resources = ARRAY_SIZE(wm831x_ldo6_resources),
.resources = wm831x_ldo6_resources,
},
{
.name = "wm831x-aldo",
- .id = 7,
+ .id = 6,
.num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
.resources = wm831x_ldo7_resources,
},
{
.name = "wm831x-aldo",
- .id = 8,
+ .id = 7,
.num_resources = ARRAY_SIZE(wm831x_ldo8_resources),
.resources = wm831x_ldo8_resources,
},
{
.name = "wm831x-aldo",
- .id = 9,
+ .id = 8,
.num_resources = ARRAY_SIZE(wm831x_ldo9_resources),
.resources = wm831x_ldo9_resources,
},
{
.name = "wm831x-aldo",
- .id = 10,
+ .id = 9,
.num_resources = ARRAY_SIZE(wm831x_ldo10_resources),
.resources = wm831x_ldo10_resources,
},
{
.name = "wm831x-alive-ldo",
- .id = 11,
+ .id = 10,
.num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
.resources = wm831x_ldo11_resources,
},
{
.name = "wm831x-on",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_on_resources),
.resources = wm831x_on_resources,
},
{
.name = "wm831x-power",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_power_resources),
.resources = wm831x_power_resources,
},
{
.name = "wm831x-status",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_status1_resources),
.resources = wm831x_status1_resources,
},
{
.name = "wm831x-status",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_status2_resources),
.resources = wm831x_status2_resources,
},
{
.name = "wm831x-watchdog",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
.resources = wm831x_wdt_resources,
},
@@ -1452,127 +1473,133 @@ static const struct mfd_cell wm8312_devs[] = {
static const struct mfd_cell wm8320_devs[] = {
{
.name = "wm831x-backup",
+ .id = -1,
},
{
.name = "wm831x-buckv",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
.resources = wm831x_dcdc1_resources,
},
{
.name = "wm831x-buckv",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
.resources = wm831x_dcdc2_resources,
},
{
.name = "wm831x-buckp",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
.resources = wm831x_dcdc3_resources,
},
{
.name = "wm831x-buckp",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm8320_dcdc4_buck_resources),
.resources = wm8320_dcdc4_buck_resources,
},
{
.name = "wm831x-clk",
+ .id = -1,
},
{
.name = "wm831x-gpio",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_gpio_resources),
.resources = wm831x_gpio_resources,
},
{
.name = "wm831x-hwmon",
+ .id = -1,
},
{
.name = "wm831x-ldo",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
.resources = wm831x_ldo1_resources,
},
{
.name = "wm831x-ldo",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
.resources = wm831x_ldo2_resources,
},
{
.name = "wm831x-ldo",
- .id = 3,
+ .id = 2,
.num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
.resources = wm831x_ldo3_resources,
},
{
.name = "wm831x-ldo",
- .id = 4,
+ .id = 3,
.num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
.resources = wm831x_ldo4_resources,
},
{
.name = "wm831x-ldo",
- .id = 5,
+ .id = 4,
.num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
.resources = wm831x_ldo5_resources,
},
{
.name = "wm831x-ldo",
- .id = 6,
+ .id = 5,
.num_resources = ARRAY_SIZE(wm831x_ldo6_resources),
.resources = wm831x_ldo6_resources,
},
{
.name = "wm831x-aldo",
- .id = 7,
+ .id = 6,
.num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
.resources = wm831x_ldo7_resources,
},
{
.name = "wm831x-aldo",
- .id = 8,
+ .id = 7,
.num_resources = ARRAY_SIZE(wm831x_ldo8_resources),
.resources = wm831x_ldo8_resources,
},
{
.name = "wm831x-aldo",
- .id = 9,
+ .id = 8,
.num_resources = ARRAY_SIZE(wm831x_ldo9_resources),
.resources = wm831x_ldo9_resources,
},
{
.name = "wm831x-aldo",
- .id = 10,
+ .id = 9,
.num_resources = ARRAY_SIZE(wm831x_ldo10_resources),
.resources = wm831x_ldo10_resources,
},
{
.name = "wm831x-alive-ldo",
- .id = 11,
+ .id = 10,
.num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
.resources = wm831x_ldo11_resources,
},
{
.name = "wm831x-on",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_on_resources),
.resources = wm831x_on_resources,
},
{
.name = "wm831x-status",
- .id = 1,
+ .id = 0,
.num_resources = ARRAY_SIZE(wm831x_status1_resources),
.resources = wm831x_status1_resources,
},
{
.name = "wm831x-status",
- .id = 2,
+ .id = 1,
.num_resources = ARRAY_SIZE(wm831x_status2_resources),
.resources = wm831x_status2_resources,
},
{
.name = "wm831x-watchdog",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
.resources = wm831x_wdt_resources,
},
@@ -1581,6 +1608,7 @@ static const struct mfd_cell wm8320_devs[] = {
static const struct mfd_cell touch_devs[] = {
{
.name = "wm831x-touch",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_touch_resources),
.resources = wm831x_touch_resources,
},
@@ -1589,6 +1617,7 @@ static const struct mfd_cell touch_devs[] = {
static const struct mfd_cell rtc_devs[] = {
{
.name = "wm831x-rtc",
+ .id = -1,
.num_resources = ARRAY_SIZE(wm831x_rtc_resources),
.resources = wm831x_rtc_resources,
},
@@ -1597,6 +1626,7 @@ static const struct mfd_cell rtc_devs[] = {
static const struct mfd_cell backlight_devs[] = {
{
.name = "wm831x-backlight",
+ .id = -1,
},
};
@@ -1774,7 +1804,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
if (pdata && pdata->wm831x_num)
wm831x_num = pdata->wm831x_num * 10;
else
- wm831x_num = -1;
+ wm831x_num = 0;
ret = wm831x_irq_init(wm831x, irq);
if (ret != 0)
--
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/