aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/of_platform.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 6029543c1b5e..b3189d0161b8 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -27,6 +27,8 @@
27#include <asm/topology.h> 27#include <asm/topology.h>
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29#include <asm/ppc-pci.h> 29#include <asm/ppc-pci.h>
30#include <asm/atomic.h>
31
30 32
31/* 33/*
32 * The list of OF IDs below is used for matching bus types in the 34 * The list of OF IDs below is used for matching bus types in the
@@ -51,6 +53,8 @@ static struct of_device_id of_default_bus_ids[] = {
51 {}, 53 {},
52}; 54};
53 55
56static atomic_t bus_no_reg_magic;
57
54/* 58/*
55 * 59 *
56 * OF platform device type definition & base infrastructure 60 * OF platform device type definition & base infrastructure
@@ -165,6 +169,7 @@ static void of_platform_make_bus_id(struct of_device *dev)
165 char *name = dev->dev.bus_id; 169 char *name = dev->dev.bus_id;
166 const u32 *reg; 170 const u32 *reg;
167 u64 addr; 171 u64 addr;
172 long magic;
168 173
169 /* 174 /*
170 * If it's a DCR based device, use 'd' for native DCRs 175 * If it's a DCR based device, use 'd' for native DCRs
@@ -203,9 +208,11 @@ static void of_platform_make_bus_id(struct of_device *dev)
203 } 208 }
204 209
205 /* 210 /*
206 * No BusID, use the node name and pray 211 * No BusID, use the node name and add a globally incremented
212 * counter (and pray...)
207 */ 213 */
208 snprintf(name, BUS_ID_SIZE, "%s", node->name); 214 magic = atomic_add_return(1, &bus_no_reg_magic);
215 snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
209} 216}
210 217
211struct of_device* of_platform_device_create(struct device_node *np, 218struct of_device* of_platform_device_create(struct device_node *np,