diff options
| author | Rob Herring <robh@kernel.org> | 2014-05-07 16:17:26 -0400 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2014-05-13 15:11:09 -0400 |
| commit | b8acee3ef83f0fc50e57a3d4c91234982befda95 (patch) | |
| tree | 85e9ed42b391e329b68020307736dcf3f7a136be /drivers/of | |
| parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (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" <iivanov@mm-sol.com>
Cc: Josh Cartwright <joshc@codeaurora.org>
Cc: Courtney Cavin <courtney.cavin@sonymobile.com>
Cc: Bjorn Andersson <bjorn@kryo.se>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Tested-by: Frank Rowand <frank.rowand@sonymobile.com>
Reviewed-by: Frank Rowand <frank.rowand@sonymobile.com>
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/platform.c | 11 |
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) | |||
| 78 | struct device_node *node = dev->of_node; | 78 | struct device_node *node = dev->of_node; |
| 79 | const __be32 *reg; | 79 | const __be32 *reg; |
| 80 | u64 addr; | 80 | u64 addr; |
| 81 | const __be32 *addrp; | ||
| 82 | int magic; | 81 | int magic; |
| 83 | 82 | ||
| 84 | #ifdef CONFIG_PPC_DCR | 83 | #ifdef CONFIG_PPC_DCR |
| @@ -106,15 +105,7 @@ void of_device_make_bus_id(struct device *dev) | |||
| 106 | */ | 105 | */ |
| 107 | reg = of_get_property(node, "reg", NULL); | 106 | reg = of_get_property(node, "reg", NULL); |
| 108 | if (reg) { | 107 | if (reg) { |
| 109 | if (of_can_translate_address(node)) { | 108 | addr = of_translate_address(node, reg); |
| 110 | addr = of_translate_address(node, reg); | ||
| 111 | } else { | ||
| 112 | addrp = of_get_address(node, 0, NULL, NULL); | ||
| 113 | if (addrp) | ||
| 114 | addr = of_read_number(addrp, 1); | ||
| 115 | else | ||
| 116 | addr = OF_BAD_ADDR; | ||
| 117 | } | ||
| 118 | if (addr != OF_BAD_ADDR) { | 109 | if (addr != OF_BAD_ADDR) { |
| 119 | dev_set_name(dev, "%llx.%s", | 110 | dev_set_name(dev, "%llx.%s", |
| 120 | (unsigned long long)addr, node->name); | 111 | (unsigned long long)addr, node->name); |
