[PATCH v3 0/4] mfd: Fix platform device ids to avoid probe failure

From: Bartlomiej Zolnierkiewicz
Date: Mon Mar 23 2015 - 11:09:36 EST


Hi,

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.

Relevant error messages (in this case for MAX8997 PMIC driver):

[ 0.911674] ------------[ cut here ]------------
[ 0.911706] WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x54/0x70()
[ 0.911718] sysfs: cannot create duplicate filename '/devices/13860000.i2c/i2c-0/0-0066/max8997-led'
...
[ 0.912382] ------------[ cut here ]------------
[ 0.912402] WARNING: CPU: 0 PID: 1 at lib/kobject.c:240 kobject_add_internal+0x238/0x2c0()
[ 0.912411] kobject_add_internal failed for max8997-led with -EEXIST, don't try to register things with the same name in th
...
[ 0.920721] max8997 0-0066: failed to add MFD devices -17
[ 0.921553] max8997: probe of 0-0066 failed with error -17

Change mfd_add_devices() mfd id base from -1 to PLATFORM_DEVID_AUTO
to fix the issue.

[ Please note that this only fixes mfd drivers and mfd client
drivers still need to be updated to use mfd_get_cell(pdev)->id
instead of pdev->id. This is why I think that for v3.19 and
for v4.0 it would be the best to merge v2 of patches #1-3 as
they restore previous behavior fully (no need to update mfd
client drivers). PLATFORM_DEVID_AUTO conversion can then be
introduced later (i.e. in v4.1). ]

MAX8997 PMIC fix was tested on Exynos4210 Origen board, the rest of
patches is compile tested only.

Changes since v2:
- do PLATFORM_DEVID_AUTO conversion

Changes since v1:
- corrected 'stable' mailing list address, no other changes

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (4):
mfd: max8997: Fix platform device ids to avoid probe failure
mfd: da9055: Fix platform device ids to avoid probe failure
mfd: lp8788: Fix platform device ids to avoid probe failure
mfd: wm831x: Fix platform device ids to avoid probe failure

drivers/mfd/da9055-core.c | 2 +-
drivers/mfd/lp8788.c | 2 +-
drivers/mfd/max8997.c | 2 +-
drivers/mfd/wm831x-core.c | 26 ++++++++++----------------
4 files changed, 13 insertions(+), 19 deletions(-)

--
1.7.9.5

--
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/