From: Jia Hongtao <B38951-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: b38951-KZfg59tc24xl57MIdRCFDg@public.gmane.org
Subject: [PATCH V3 5/6] Avoid duplicate probe for of platform devices
Date: Fri, 8 Jun 2012 17:43:05 +0800 [thread overview]
Message-ID: <1339148585-16947-1-git-send-email-B38951@freescale.com> (raw)
We changed the pcie controller driver to platform driver so that the PCI
of platform devices need to be created earlier in the arch_initcall stage
according to the original timing of calling fsl_add_bridge(). So we do PCI
probing separately from other devices. But probing more than once could
cause duplication warning. We add check if the devices have already probed
before probing any devices to avoid duplication warning.
Signed-off-by: Jia Hongtao <B38951-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Signed-off-by: Li Yang <leoli-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
drivers/of/platform.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index a37330e..3aab01f 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -139,6 +139,18 @@ struct platform_device *of_device_alloc(struct device_node *np,
if (!dev)
return NULL;
+ dev->dev.of_node = of_node_get(np);
+ if (bus_id)
+ dev_set_name(&dev->dev, "%s", bus_id);
+ else
+ of_device_make_bus_id(&dev->dev);
+
+ if (kset_find_obj(dev->dev.kobj.kset, kobject_name(&dev->dev.kobj))) {
+ kfree(dev);
+ of_node_put(np);
+ return NULL;
+ }
+
/* count the io and irq resources */
while (of_address_to_resource(np, num_reg, &temp_res) == 0)
num_reg++;
@@ -161,17 +173,11 @@ struct platform_device *of_device_alloc(struct device_node *np,
WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq);
}
- dev->dev.of_node = of_node_get(np);
#if defined(CONFIG_MICROBLAZE)
dev->dev.dma_mask = &dev->archdata.dma_mask;
#endif
dev->dev.parent = parent;
- if (bus_id)
- dev_set_name(&dev->dev, "%s", bus_id);
- else
- of_device_make_bus_id(&dev->dev);
-
return dev;
}
EXPORT_SYMBOL(of_device_alloc);
--
1.7.5.1
next reply other threads:[~2012-06-08 9:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 9:43 Jia Hongtao [this message]
2012-06-11 15:33 ` [PATCH V3 5/6] Avoid duplicate probe for of platform devices Rob Herring
2012-06-12 2:16 ` Jia Hongtao-B38951
[not found] ` <4FD60FB1.7050106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-06 2:05 ` Jia Hongtao-B38951
2012-07-06 4:26 ` Greg KH
[not found] ` <20120706042611.GA1841-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-07-06 6:07 ` Jia Hongtao-B38951
2012-07-06 16:17 ` Greg KH
[not found] ` <20120706161718.GA26894-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-07-09 2:34 ` Jia Hongtao-B38951
[not found] ` <412C8208B4A0464FA894C5F0C278CD5D01A1E694-TcFNo7jSaXPiTqIcKZ1S2K4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2012-07-09 3:46 ` Li Yang-R58472
2012-07-09 13:58 ` Rob Herring
2012-07-10 2:29 ` Jia Hongtao-B38951
2012-07-09 14:58 ` Greg KH
[not found] ` <20120709145831.GB3961-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-07-11 18:01 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339148585-16947-1-git-send-email-B38951@freescale.com \
--to=b38951-kzfg59tc24xl57midrcfdg@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).