Commit 9663eb21 authored by Daniel Hellstrom's avatar Daniel Hellstrom Committed by David S. Miller

SPARC/LEON: avoid AMBAPP name duplicates in openprom fs when REG is missing

When the REG property is not available the NODE-ID is used as an unique
identifier in order to avoid filesystem name duplicates in /proc/openprom
filesystem
Signed-off-by: default avatarDaniel Hellstrom <daniel@gaisler.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2791c1a4
...@@ -136,18 +136,29 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf) ...@@ -136,18 +136,29 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
/* "name:vendor:device@irq,addrlo" */ /* "name:vendor:device@irq,addrlo" */
static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf) static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
{ {
struct amba_prom_registers *regs; unsigned int *intr; struct amba_prom_registers *regs;
unsigned int *device, *vendor; unsigned int *intr, *device, *vendor, reg0;
struct property *prop; struct property *prop;
int interrupt = 0;
/* In order to get a unique ID in the device tree (multiple AMBA devices
* may have the same name) the node number is printed
*/
prop = of_find_property(dp, "reg", NULL); prop = of_find_property(dp, "reg", NULL);
if (!prop) if (!prop) {
return; reg0 = (unsigned int)dp->phandle;
} else {
regs = prop->value; regs = prop->value;
reg0 = regs->phys_addr;
}
/* Not all cores have Interrupt */
prop = of_find_property(dp, "interrupts", NULL); prop = of_find_property(dp, "interrupts", NULL);
if (!prop) if (!prop)
return; intr = &interrupt; /* IRQ0 does not exist */
else
intr = prop->value; intr = prop->value;
prop = of_find_property(dp, "vendor", NULL); prop = of_find_property(dp, "vendor", NULL);
if (!prop) if (!prop)
return; return;
...@@ -159,7 +170,7 @@ static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf) ...@@ -159,7 +170,7 @@ static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
sprintf(tmp_buf, "%s:%d:%d@%x,%x", sprintf(tmp_buf, "%s:%d:%d@%x,%x",
dp->name, *vendor, *device, dp->name, *vendor, *device,
*intr, regs->phys_addr); *intr, reg0);
} }
static void __init __build_path_component(struct device_node *dp, char *tmp_buf) static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment