diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-01-03 17:51:11 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-01-03 18:02:49 -0500 |
commit | cd1e65044d4473cca9a01bae7b7938f065044a4b (patch) | |
tree | a2c958b4bd303c88320650d4e8251e0aba64ef91 /drivers/of/platform.c | |
parent | 6bd121e2d4dcabb145d390a7131ec83102dfb838 (diff) |
of/device: Don't register disabled devices
Device nodes with the property status="disabled" are not usable and so
don't register them when parsing the device tree for devices.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Hollis Blanchard <hollis_blanchard@mentor.com>
Cc: Deepak Saxena <deepak_saxena@mentor.com>
Cc: Scott Wood <scottwood@freescale.com>,
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r-- | drivers/of/platform.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 5b4a07f1220e..c01cd1ac7617 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc); | |||
633 | * @np: pointer to node to create device for | 633 | * @np: pointer to node to create device for |
634 | * @bus_id: name to assign device | 634 | * @bus_id: name to assign device |
635 | * @parent: Linux device model parent device. | 635 | * @parent: Linux device model parent device. |
636 | * | ||
637 | * Returns pointer to created platform device, or NULL if a device was not | ||
638 | * registered. Unavailable devices will not get registered. | ||
636 | */ | 639 | */ |
637 | struct platform_device *of_platform_device_create(struct device_node *np, | 640 | struct platform_device *of_platform_device_create(struct device_node *np, |
638 | const char *bus_id, | 641 | const char *bus_id, |
@@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np, | |||
640 | { | 643 | { |
641 | struct platform_device *dev; | 644 | struct platform_device *dev; |
642 | 645 | ||
646 | if (!of_device_is_available(np)) | ||
647 | return NULL; | ||
648 | |||
643 | dev = of_device_alloc(np, bus_id, parent); | 649 | dev = of_device_alloc(np, bus_id, parent); |
644 | if (!dev) | 650 | if (!dev) |
645 | return NULL; | 651 | return NULL; |
@@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus, | |||
683 | pr_debug(" create child: %s\n", child->full_name); | 689 | pr_debug(" create child: %s\n", child->full_name); |
684 | dev = of_platform_device_create(child, NULL, parent); | 690 | dev = of_platform_device_create(child, NULL, parent); |
685 | if (dev == NULL) | 691 | if (dev == NULL) |
686 | rc = -ENOMEM; | 692 | continue; |
687 | else if (!of_match_node(matches, child)) | 693 | |
694 | if (!of_match_node(matches, child)) | ||
688 | continue; | 695 | continue; |
689 | if (rc == 0) { | 696 | if (rc == 0) { |
690 | pr_debug(" and sub busses\n"); | 697 | pr_debug(" and sub busses\n"); |
@@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root, | |||
733 | if (of_match_node(matches, root)) { | 740 | if (of_match_node(matches, root)) { |
734 | pr_debug(" root match, create all sub devices\n"); | 741 | pr_debug(" root match, create all sub devices\n"); |
735 | dev = of_platform_device_create(root, NULL, parent); | 742 | dev = of_platform_device_create(root, NULL, parent); |
736 | if (dev == NULL) { | 743 | if (dev == NULL) |
737 | rc = -ENOMEM; | ||
738 | goto bail; | 744 | goto bail; |
739 | } | 745 | |
740 | pr_debug(" create all sub busses\n"); | 746 | pr_debug(" create all sub busses\n"); |
741 | rc = of_platform_bus_create(root, matches, &dev->dev); | 747 | rc = of_platform_bus_create(root, matches, &dev->dev); |
742 | goto bail; | 748 | goto bail; |
@@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root, | |||
748 | pr_debug(" match: %s\n", child->full_name); | 754 | pr_debug(" match: %s\n", child->full_name); |
749 | dev = of_platform_device_create(child, NULL, parent); | 755 | dev = of_platform_device_create(child, NULL, parent); |
750 | if (dev == NULL) | 756 | if (dev == NULL) |
751 | rc = -ENOMEM; | 757 | continue; |
752 | else | 758 | |
753 | rc = of_platform_bus_create(child, matches, &dev->dev); | 759 | rc = of_platform_bus_create(child, matches, &dev->dev); |
754 | if (rc) { | 760 | if (rc) { |
755 | of_node_put(child); | 761 | of_node_put(child); |
756 | break; | 762 | break; |