All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak Saxena <deepak_saxena@mentor.com>
To: devicetree-discuss@ozlabs.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 1/5] of/device: Centralize checking of 'status' properties
Date: Wed, 8 Dec 2010 11:29:13 -0800	[thread overview]
Message-ID: <20101208192913.GB32473@mentor.com> (raw)
In-Reply-To: <cover.1291799069.git.deepak_saxena@mentor.com>

Don't call any of_platform_driver's probe() function if the device node is
not accessible (as denoted in the status property).

Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
Signed-off-by: Deepak Saxena <deepak_saxena@mentor.com>
---
 arch/powerpc/platforms/83xx/suspend.c |    3 ---
 drivers/mmc/host/sdhci-of-core.c      |    3 ---
 drivers/net/gianfar.c                 |    2 +-
 drivers/net/ibm_newemac/core.c        |    2 +-
 drivers/of/platform.c                 |    7 +++++--
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 75ae77f..a5a54aa 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -326,9 +326,6 @@ static int pmc_probe(struct platform_device *ofdev,
 	struct pmc_type *type = match->data;
 	int ret = 0;
 
-	if (!of_device_is_available(np))
-		return -ENODEV;
-
 	has_deep_sleep = type->has_deep_sleep;
 	immrbase = get_immrbase();
 	pmc_dev = ofdev;
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index c51b711..51218d4 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -126,9 +126,6 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
 	int size;
 	int ret;
 
-	if (!of_device_is_available(np))
-		return -ENODEV;
-
 	host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host));
 	if (IS_ERR(host))
 		return -ENOMEM;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d1bec62..9918914 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -620,7 +620,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 	unsigned int num_tx_qs, num_rx_qs;
 	u32 *tx_queues, *rx_queues;
 
-	if (!np || !of_device_is_available(np))
+	if (!np)
 		return -ENODEV;
 
 	/* parse the num of tx and rx queues */
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 06bb9b7..290fff2 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2732,7 +2732,7 @@ static int __devinit emac_probe(struct platform_device *ofdev,
 	 * property here for now, but new flat device trees should set a
 	 * status property to "disabled" instead.
 	 */
-	if (of_get_property(np, "unused", NULL) || !of_device_is_available(np))
+	if (of_get_property(np, "unused", NULL))
 		return -ENODEV;
 
 	/* Find ourselves in the bootlist if we are there */
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5b4a07f..14370a0 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -56,7 +56,10 @@ static int platform_driver_probe_shim(struct platform_device *pdev)
 	 * come up empty.  Return -EINVAL in this case so other drivers get
 	 * the chance to bind. */
 	match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
-	return match ? ofpdrv->probe(pdev, match) : -EINVAL;
+	if (match && of_device_is_available(pdev->dev.of_node))
+		return ofpdrv->probe(pdev, match);
+
+	return -EINVAL;
 }
 
 static void platform_driver_shutdown_shim(struct platform_device *pdev)
@@ -142,7 +145,7 @@ static int of_platform_device_probe(struct device *dev)
 	of_dev_get(of_dev);
 
 	match = of_match_device(drv->driver.of_match_table, dev);
-	if (match)
+	if (match && of_device_is_available(dev->of_node))
 		error = drv->probe(of_dev, match);
 	if (error)
 		of_dev_put(of_dev);
-- 
1.6.3.3

WARNING: multiple messages have this Message-ID (diff)
From: Deepak Saxena <deepak_saxena-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
To: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 1/5] of/device: Centralize checking of 'status' properties
Date: Wed, 8 Dec 2010 11:29:13 -0800	[thread overview]
Message-ID: <20101208192913.GB32473@mentor.com> (raw)
In-Reply-To: <cover.1291799069.git.deepak_saxena-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>

Don't call any of_platform_driver's probe() function if the device node is
not accessible (as denoted in the status property).

Signed-off-by: Hollis Blanchard <hollis_blanchard-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Deepak Saxena <deepak_saxena-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
---
 arch/powerpc/platforms/83xx/suspend.c |    3 ---
 drivers/mmc/host/sdhci-of-core.c      |    3 ---
 drivers/net/gianfar.c                 |    2 +-
 drivers/net/ibm_newemac/core.c        |    2 +-
 drivers/of/platform.c                 |    7 +++++--
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 75ae77f..a5a54aa 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -326,9 +326,6 @@ static int pmc_probe(struct platform_device *ofdev,
 	struct pmc_type *type = match->data;
 	int ret = 0;
 
-	if (!of_device_is_available(np))
-		return -ENODEV;
-
 	has_deep_sleep = type->has_deep_sleep;
 	immrbase = get_immrbase();
 	pmc_dev = ofdev;
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index c51b711..51218d4 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -126,9 +126,6 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
 	int size;
 	int ret;
 
-	if (!of_device_is_available(np))
-		return -ENODEV;
-
 	host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host));
 	if (IS_ERR(host))
 		return -ENOMEM;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d1bec62..9918914 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -620,7 +620,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 	unsigned int num_tx_qs, num_rx_qs;
 	u32 *tx_queues, *rx_queues;
 
-	if (!np || !of_device_is_available(np))
+	if (!np)
 		return -ENODEV;
 
 	/* parse the num of tx and rx queues */
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 06bb9b7..290fff2 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2732,7 +2732,7 @@ static int __devinit emac_probe(struct platform_device *ofdev,
 	 * property here for now, but new flat device trees should set a
 	 * status property to "disabled" instead.
 	 */
-	if (of_get_property(np, "unused", NULL) || !of_device_is_available(np))
+	if (of_get_property(np, "unused", NULL))
 		return -ENODEV;
 
 	/* Find ourselves in the bootlist if we are there */
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5b4a07f..14370a0 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -56,7 +56,10 @@ static int platform_driver_probe_shim(struct platform_device *pdev)
 	 * come up empty.  Return -EINVAL in this case so other drivers get
 	 * the chance to bind. */
 	match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
-	return match ? ofpdrv->probe(pdev, match) : -EINVAL;
+	if (match && of_device_is_available(pdev->dev.of_node))
+		return ofpdrv->probe(pdev, match);
+
+	return -EINVAL;
 }
 
 static void platform_driver_shutdown_shim(struct platform_device *pdev)
@@ -142,7 +145,7 @@ static int of_platform_device_probe(struct device *dev)
 	of_dev_get(of_dev);
 
 	match = of_match_device(drv->driver.of_match_table, dev);
-	if (match)
+	if (match && of_device_is_available(dev->of_node))
 		error = drv->probe(of_dev, match);
 	if (error)
 		of_dev_put(of_dev);
-- 
1.6.3.3

       reply	other threads:[~2010-12-08 19:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1291799069.git.deepak_saxena@mentor.com>
2010-12-08 19:29 ` Deepak Saxena [this message]
2010-12-08 19:29   ` [PATCH 1/5] of/device: Centralize checking of 'status' properties Deepak Saxena
2010-12-31  7:43   ` Grant Likely
2010-12-08 19:29 ` [PATCH 4/5] of/device: Create _of_get_next_child() Deepak Saxena
2010-12-08 19:29   ` Deepak Saxena
2010-12-08 19:29 ` [PATCH 5/5] of/device: Show even unavailable nodes in procfs Deepak Saxena
2010-12-08 19:29   ` Deepak Saxena
2010-12-08 19:29 ` [PATCH 3/5] of/device: Make of_get_next_child() check status properties Deepak Saxena
2010-12-08 21:01   ` Scott Wood
2010-12-09  1:33     ` Michael Ellerman
2010-12-09  1:33       ` Michael Ellerman
2010-12-09  3:09       ` David Gibson
2010-12-09  3:09         ` David Gibson
2010-12-15 18:35         ` Hollis Blanchard
2010-12-15 18:35           ` Hollis Blanchard
2010-12-15 22:40           ` Michael Ellerman
2010-12-15 22:40             ` Michael Ellerman
2010-12-31  7:39             ` Grant Likely
2010-12-31  7:39               ` Grant Likely
2010-12-08 19:29 ` [PATCH 2/5] of/device: make for_each_node* " Deepak Saxena
2010-12-08 19:29   ` Deepak Saxena
2010-12-31  7:46   ` Grant Likely
2010-12-31  7:46     ` 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=20101208192913.GB32473@mentor.com \
    --to=deepak_saxena@mentor.com \
    --cc=devicetree-discuss@ozlabs.org \
    --cc=linuxppc-dev@lists.ozlabs.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 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.