devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Grant Likely <grant.likely@linaro.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Cc: "Ivan T. Ivanov" <iivanov@mm-sol.com>,
	Josh Cartwright <joshc@codeaurora.org>,
	Courtney Cavin <courtney.cavin@sonymobile.com>,
	Bjorn Andersson <bjorn@kryo.se>,
	Frank Rowand <frowand.list@gmail.com>,
	Rob Herring <robh@kernel.org>
Subject: [PATCH 4/4] of: kill off of_can_translate_address
Date: Wed,  7 May 2014 16:48:18 -0500	[thread overview]
Message-ID: <1399499298-8830-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1399499298-8830-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <robh@kernel.org>

of_can_translate_address only checks some conditions for address
translation, but does not check other conditions like having range
properties. The checks it does do are redundant with
__of_address_translate. The only difference is printing a message or
not. Since we only have a single caller that does the full translation
anyway, just remove of_can_translate_address and quiet the error
message.

Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/of/address.c       | 22 +---------------------
 drivers/of/platform.c      |  5 ++---
 include/linux/of_address.h |  1 -
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index cb4242a..95351b2 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -498,8 +498,7 @@ static u64 __of_translate_address(struct device_node *dev,
 	/* Count address cells & copy address locally */
 	bus->count_cells(dev, &na, &ns);
 	if (!OF_CHECK_COUNTS(na, ns)) {
-		printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
-		       of_node_full_name(dev));
+		pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev));
 		goto bail;
 	}
 	memcpy(addr, in_addr, na * 4);
@@ -564,25 +563,6 @@ u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
 }
 EXPORT_SYMBOL(of_translate_dma_address);
 
-bool of_can_translate_address(struct device_node *dev)
-{
-	struct device_node *parent;
-	struct of_bus *bus;
-	int na, ns;
-
-	parent = of_get_parent(dev);
-	if (parent == NULL)
-		return false;
-
-	bus = of_match_bus(parent);
-	bus->count_cells(dev, &na, &ns);
-
-	of_node_put(parent);
-
-	return OF_CHECK_COUNTS(na, ns);
-}
-EXPORT_SYMBOL(of_can_translate_address);
-
 const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
 		    unsigned int *flags)
 {
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index d827ceb..07cfd1b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -140,9 +140,8 @@ struct platform_device *of_device_alloc(struct device_node *np,
 		return NULL;
 
 	/* count the io and irq resources */
-	if (of_can_translate_address(np))
-		while (of_address_to_resource(np, num_reg, &temp_res) == 0)
-			num_reg++;
+	while (of_address_to_resource(np, num_reg, &temp_res) == 0)
+		num_reg++;
 	num_irq = of_irq_count(np);
 
 	/* Populate the resource table */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 5f6ed6b..906ca76 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -40,7 +40,6 @@ extern u64 of_translate_dma_address(struct device_node *dev,
 
 #ifdef CONFIG_OF_ADDRESS
 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
-extern bool of_can_translate_address(struct device_node *dev);
 extern int of_address_to_resource(struct device_node *dev, int index,
 				  struct resource *r);
 extern struct device_node *of_find_matching_node_by_address(
-- 
1.9.1

      parent reply	other threads:[~2014-05-07 21:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 21:48 [PATCH 0/4] DT platform device name collision fixes Rob Herring
     [not found] ` <1399499298-8830-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-07 21:48   ` [PATCH 1/4] of/selftest: add testcase for nodes with same name and address Rob Herring
     [not found]     ` <1399499298-8830-2-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-08  2:51       ` Frank Rowand
2014-05-08  8:59         ` Grant Likely
2014-05-08 19:44           ` Frank Rowand
     [not found]         ` <536AF13F.6000502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-09  4:28           ` Frank Rowand
2014-05-08  9:00       ` Grant Likely
2014-05-07 22:52   ` [PATCH 0/4] DT platform device name collision fixes Frank Rowand
     [not found]     ` <536AB91F.3010302-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-08  2:54       ` Frank Rowand
2014-05-07 21:48 ` [PATCH 2/4] of/platform: return error on of_platform_device_create_pdata failure Rob Herring
     [not found]   ` <1399499298-8830-3-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-13 17:56     ` Olof Johansson
     [not found]       ` <20140513175603.GA27173-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org>
2014-05-13 18:31         ` Rob Herring
2014-05-13 20:32       ` Frank Rowand
2014-05-13 20:37         ` Olof Johansson
     [not found]         ` <53728173.7050508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-14  7:43           ` Ivan T. Ivanov
2014-05-07 21:48 ` [PATCH 3/4] of/platform: fix device naming for non-translatable addresses Rob Herring
2014-05-08 10:41   ` Arnd Bergmann
2014-05-08 12:55     ` Rob Herring
     [not found]       ` <CAL_JsqJEW_Xrfi7OiF6caHVup1Y6-8SvyOJawov8o3oiYiFvXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-08 13:15         ` Arnd Bergmann
2014-05-08 11:47   ` Ivan T. Ivanov
2014-05-07 21:48 ` Rob Herring [this message]

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=1399499298-8830-5-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=bjorn@kryo.se \
    --cc=courtney.cavin@sonymobile.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=iivanov@mm-sol.com \
    --cc=joshc@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.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).