[PATCH 1/1] mfd: Fix runtime warning caused by duplicate device registration

From: Lee Jones
Date: Tue Jul 03 2012 - 07:59:50 EST


We register the ab8500 as an MFD device from db8500 code during Device Tree
boot in order to solve some limitations of DT. However, when Device Tree is
not enabled, we still want to allow platform code to register the ab8500 in
the normal way. Here we force MFD device registration of the ab8500 only
when booting with Device Tree enabled.

Solves this issue:
WARNING: at fs/sysfs/dir.c:526 sysfs_add_one+0x88/0xb0()
sysfs: cannot create duplicate filename '/bus/platform/devices/ab8500-core.0'

Reported-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
---
drivers/mfd/db8500-prcmu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 80def6c..4ec0ed1 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -2964,6 +2964,9 @@ static struct mfd_cell db8500_prcmu_devs[] = {
.name = "cpufreq-u8500",
.of_compatible = "stericsson,cpufreq-u8500",
},
+};
+
+static struct mfd_cell db8500_of_prcmu_devs[] = {
{
.name = "ab8500-core",
.of_compatible = "stericsson,ab8500",
@@ -3014,6 +3017,15 @@ static int __devinit db8500_prcmu_probe(struct platform_device *pdev)
return err;
}

+ if (np) {
+ err = mfd_add_devices(&pdev->dev, 0, db8500_of_prcmu_devs,
+ ARRAY_SIZE(db8500_of_prcmu_devs), NULL, 0);
+ if (err) {
+ pr_err("prcmu: Failed to add DT subdevices\n");
+ return err;
+ }
+ }
+
pr_info("DB8500 PRCMU initialized\n");

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