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>
This commit is contained in:
Родитель
d6d211db37
Коммит
b8acee3ef8
|
@ -78,7 +78,6 @@ void of_device_make_bus_id(struct device *dev)
|
||||||
struct device_node *node = dev->of_node;
|
struct device_node *node = dev->of_node;
|
||||||
const __be32 *reg;
|
const __be32 *reg;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
const __be32 *addrp;
|
|
||||||
int magic;
|
int magic;
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_DCR
|
#ifdef CONFIG_PPC_DCR
|
||||||
|
@ -106,15 +105,7 @@ void of_device_make_bus_id(struct device *dev)
|
||||||
*/
|
*/
|
||||||
reg = of_get_property(node, "reg", NULL);
|
reg = of_get_property(node, "reg", NULL);
|
||||||
if (reg) {
|
if (reg) {
|
||||||
if (of_can_translate_address(node)) {
|
addr = of_translate_address(node, reg);
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (addr != OF_BAD_ADDR) {
|
if (addr != OF_BAD_ADDR) {
|
||||||
dev_set_name(dev, "%llx.%s",
|
dev_set_name(dev, "%llx.%s",
|
||||||
(unsigned long long)addr, node->name);
|
(unsigned long long)addr, node->name);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче