RE: [PATCH V3 5/6] Avoid duplicate probe for of platform devices
From: Jia Hongtao-B38951 <hidden>
Date: 2012-07-09 02:35:57
Also in:
lkml
-----Original Message----- From: Greg KH [mailto:greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org] Sent: Saturday, July 07, 2012 12:17 AM To: Jia Hongtao-B38951 Cc: Rob Herring; devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org; linux- kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Li Yang-R58472 Subject: Re: [PATCH V3 5/6] Avoid duplicate probe for of platform devices On Fri, Jul 06, 2012 at 06:07:43AM +0000, Jia Hongtao-B38951 wrote:quoted
quoted
-----Original Message----- From: Greg KH [mailto:greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org] Sent: Friday, July 06, 2012 12:26 PM To: Jia Hongtao-B38951 Cc: Rob Herring; devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org; linux- kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Li Yang-R58472 Subject: Re: [PATCH V3 5/6] Avoid duplicate probe for of platformdevicesquoted
quoted
On Fri, Jul 06, 2012 at 02:05:05AM +0000, Jia Hongtao-B38951 wrote:quoted
Hi Rob and Greg KH, Do you have any better idea to avoid duplication probe warning?I have no idea what the problem is that you are trying to solve.quoted
quoted
On 06/08/2012 04:43 AM, Jia Hongtao wrote:quoted
We changed the pcie controller driver to platform driver sothatquoted
quoted
thequoted
quoted
PCIquoted
of platform devices need to be created earlier in thearch_initcallquoted
quoted
quoted
quoted
stagequoted
according to the original timing of calling fsl_add_bridge().So wequoted
quoted
doquoted
quoted
PCIquoted
probing separately from other devices. But probing more thanoncequoted
quoted
couldquoted
quoted
quoted
cause duplication warning. We add check if the devices havealreadyquoted
quoted
quoted
quoted
probedquoted
before probing any devices to avoid duplication warning.Ick, something else is going wrong here, how could you ever have the same device probed more than once?quoted
quoted
quoted
Signed-off-by: Jia Hongtao <redacted> Signed-off-by: Li Yang <redacted> ---Where's v1 and v2 history?quoted
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(structquoted
quoted
quoted
quoted
device_node *np,quoted
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)))Whatever you are trying to do here, odds are, it's wrong :) What is happening that is causing the problem? What is causing the platform core to be calling probe on a device more than once? greg k-hThis is why in some cases we may probe twice: Firstly, we need to probe pci controller separately. But in KVMdifferentquoted
topology of device tree is used in which pci nodes are not under rootnodequoted
but under "simple bus". Unfortunately, of_platform_bus_probe() willprobequoted
all the first level nodes under "simple bus" so pci nodes will probeagain. Sounds like a bug :)quoted
Two ways to solve this problem: 1. All the nodes that need to be probed should just under root.That seems reasonable.quoted
2. Avoid duplication probe at runtime like this patch did.No, don't paper over the real problem in the platform core code like this. Fix the real issue here instead.quoted
I do like the first one but it's hard to changing the traditional waythatquoted
exist for a long time.I don't understand, why is this just showing up now? What changed to cause this? Couldn't that be the real problem here?
The issue is showing up because we now probe devices twice. Previously, we just probe devices once. But now we changed the way of pci init which makes pci controllers should be probed earlier than other devices. So we have to probe pci nodes separately. Probe more than once is the root cause of this issue. The pci patchset I mentioned please refer to: http://patchwork.ozlabs.org/patch/163742/ - Jia Hongtao.