All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 5/6] Avoid duplicate probe for of platform devices
@ 2012-06-08  9:43 Jia Hongtao
  2012-06-11 15:33 ` Rob Herring
  0 siblings, 1 reply; 25+ messages in thread
From: Jia Hongtao @ 2012-06-08  9:43 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ; +Cc: b38951-KZfg59tc24xl57MIdRCFDg

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

^ permalink raw reply related	[flat|nested] 25+ messages in thread
* [PATCH 0/6] Description for PCI patches using platform driver
@ 2012-06-08  9:42 Jia Hongtao
  2012-06-08  9:42 ` [PATCH V3 5/6] Avoid duplicate probe for of platform devices Jia Hongtao
  0 siblings, 1 reply; 25+ messages in thread
From: Jia Hongtao @ 2012-06-08  9:42 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: R65777, b38951, B07421

This series of patches are to unify pci initialization code and add PM support
for all 85xx/86xx powerpc boards. But two side effects are introduced by this
mechanism which listed below:

1. of_platform_bus_probe() will be called twice but in some cases duplication
   warning occured. We fix this in [PATCH 5/6].

2. Edac driver failed to register pci nodes as platform devices. We fix this
   in [PATCH 6/6].

These patches are against 'next' branch on:
http://git.kernel.org/?p=linux/kernel/git/galak/powerpc.git

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-07-12  3:35 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-08  9:43 [PATCH V3 5/6] Avoid duplicate probe for of platform devices Jia Hongtao
2012-06-11 15:33 ` Rob Herring
2012-06-12  2:16   ` Jia Hongtao-B38951
2012-06-12  2:16     ` Jia Hongtao-B38951
2012-07-06  2:05   ` Jia Hongtao-B38951
2012-07-06  2:05     ` Jia Hongtao-B38951
2012-07-06  4:26     ` Greg KH
2012-07-06  4:26       ` Greg KH
2012-07-06  6:07       ` Jia Hongtao-B38951
2012-07-06  6:07         ` Jia Hongtao-B38951
2012-07-06 16:17         ` Greg KH
2012-07-06 16:17           ` Greg KH
2012-07-09  2:34           ` Jia Hongtao-B38951
2012-07-09  2:34             ` Jia Hongtao-B38951
2012-07-09  3:46             ` Li Yang-R58472
2012-07-09  3:46               ` Li Yang-R58472
2012-07-09 13:58               ` Rob Herring
2012-07-09 13:58                 ` Rob Herring
2012-07-10  2:29                 ` Jia Hongtao-B38951
2012-07-10  2:29                   ` Jia Hongtao-B38951
2012-07-09 14:58               ` Greg KH
2012-07-09 14:58                 ` Greg KH
2012-07-11 18:01                 ` Grant Likely
2012-07-11 18:01                   ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2012-06-08  9:42 [PATCH 0/6] Description for PCI patches using platform driver Jia Hongtao
2012-06-08  9:42 ` [PATCH V3 5/6] Avoid duplicate probe for of platform devices Jia Hongtao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.