aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2014-05-07 15:17:26 -0500
committerRob Herring <[email protected]>2014-05-13 14:11:09 -0500
commitb8acee3ef83f0fc50e57a3d4c91234982befda95 (patch)
tree85e9ed42b391e329b68020307736dcf3f7a136be
parentd6d211db37e75de2ddc3a4f979038c40df7cc79c (diff)
of/platform: fix device naming for non-translatable addresses
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" <[email protected]> Cc: Josh Cartwright <[email protected]> Cc: Courtney Cavin <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: Grant Likely <[email protected]> Signed-off-by: Rob Herring <[email protected]> Tested-by: Ivan T. Ivanov <[email protected]> Tested-by: Frank Rowand <[email protected]> Reviewed-by: Frank Rowand <[email protected]>
-rw-r--r--drivers/of/platform.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index bd47fbc53dc9..0602eb5b1be2 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);