[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1399499298-8830-4-git-send-email-robherring2@gmail.com>
Date: Wed, 7 May 2014 16:48:17 -0500
From: Rob Herring <robherring2@...il.com>
To: Grant Likely <grant.likely@...aro.org>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Cc: "Ivan T. Ivanov" <iivanov@...sol.com>,
Josh Cartwright <joshc@...eaurora.org>,
Courtney Cavin <courtney.cavin@...ymobile.com>,
Bjorn Andersson <bjorn@...o.se>,
Frank Rowand <frowand.list@...il.com>,
Rob Herring <robh@...nel.org>
Subject: [PATCH 3/4] of/platform: fix device naming for non-translatable addresses
From: Rob Herring <robh@...nel.org>
Using non-translatable addresses in platform device names is wrong
because they may not be globally unique. Just use the default naming with
a global index if the address cannot be translated instead.
of_can_translate_address has the same checks as of_translate_address, so
we can remove it here as well.
Reported-by: "Ivan T. Ivanov" <iivanov@...sol.com>
Cc: Josh Cartwright <joshc@...eaurora.org>
Cc: Courtney Cavin <courtney.cavin@...ymobile.com>
Cc: Bjorn Andersson <bjorn@...o.se>
Cc: Frank Rowand <frowand.list@...il.com>
Cc: Grant Likely <grant.likely@...aro.org>
Signed-off-by: Rob Herring <robh@...nel.org>
---
drivers/of/platform.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 622aeb3..d827ceb 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -78,7 +78,6 @@ void of_device_make_bus_id(struct device *dev)
struct device_node *node = dev->of_node;
const __be32 *reg;
u64 addr;
- const __be32 *addrp;
int magic;
#ifdef CONFIG_PPC_DCR
@@ -106,15 +105,7 @@ void of_device_make_bus_id(struct device *dev)
*/
reg = of_get_property(node, "reg", NULL);
if (reg) {
- if (of_can_translate_address(node)) {
- addr = of_translate_address(node, reg);
- } else {
- addrp = of_get_address(node, 0, NULL, NULL);
- if (addrp)
- addr = of_read_number(addrp, 1);
- else
- addr = OF_BAD_ADDR;
- }
+ addr = of_translate_address(node, reg);
if (addr != OF_BAD_ADDR) {
dev_set_name(dev, "%llx.%s",
(unsigned long long)addr, node->name);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists