Skip to content

Commit b8acee3

Browse files
committed
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]>
1 parent d6d211d commit b8acee3

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

drivers/of/platform.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void of_device_make_bus_id(struct device *dev)
7878
struct device_node *node = dev->of_node;
7979
const __be32 *reg;
8080
u64 addr;
81-
const __be32 *addrp;
8281
int magic;
8382

8483
#ifdef CONFIG_PPC_DCR
@@ -106,15 +105,7 @@ void of_device_make_bus_id(struct device *dev)
106105
*/
107106
reg = of_get_property(node, "reg", NULL);
108107
if (reg) {
109-
if (of_can_translate_address(node)) {
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-
}
108+
addr = of_translate_address(node, reg);
118109
if (addr != OF_BAD_ADDR) {
119110
dev_set_name(dev, "%llx.%s",
120111
(unsigned long long)addr, node->name);

0 commit comments

Comments
 (0)