diff options
Diffstat (limited to 'arch/sparc64/kernel/vio.c')
-rw-r--r-- | arch/sparc64/kernel/vio.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc64/kernel/vio.c index 491223a6628f..3685daf5157f 100644 --- a/arch/sparc64/kernel/vio.c +++ b/arch/sparc64/kernel/vio.c | |||
@@ -205,7 +205,8 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
205 | struct device_node *dp; | 205 | struct device_node *dp; |
206 | struct vio_dev *vdev; | 206 | struct vio_dev *vdev; |
207 | int err, tlen, clen; | 207 | int err, tlen, clen; |
208 | const u64 *id; | 208 | const u64 *id, *cfg_handle; |
209 | u64 a; | ||
209 | 210 | ||
210 | type = mdesc_get_property(hp, mp, "device-type", &tlen); | 211 | type = mdesc_get_property(hp, mp, "device-type", &tlen); |
211 | if (!type) { | 212 | if (!type) { |
@@ -221,26 +222,18 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
221 | return NULL; | 222 | return NULL; |
222 | } | 223 | } |
223 | 224 | ||
224 | if (!strcmp(type, "vdc-port")) { | 225 | id = mdesc_get_property(hp, mp, "id", NULL); |
225 | u64 a; | ||
226 | 226 | ||
227 | id = NULL; | 227 | cfg_handle = NULL; |
228 | mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { | 228 | mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { |
229 | u64 target; | 229 | u64 target; |
230 | 230 | ||
231 | target = mdesc_arc_target(hp, a); | 231 | target = mdesc_arc_target(hp, a); |
232 | id = mdesc_get_property(hp, target, | 232 | cfg_handle = mdesc_get_property(hp, target, |
233 | "cfg-handle", NULL); | 233 | "cfg-handle", NULL); |
234 | if (id) | 234 | if (cfg_handle) |
235 | break; | 235 | break; |
236 | } | 236 | } |
237 | if (!id) { | ||
238 | printk(KERN_ERR "VIO: vdc-port lacks parent " | ||
239 | "cfg-handle.\n"); | ||
240 | return NULL; | ||
241 | } | ||
242 | } else | ||
243 | id = mdesc_get_property(hp, mp, "id", NULL); | ||
244 | 237 | ||
245 | bus_id_name = type; | 238 | bus_id_name = type; |
246 | if (!strcmp(type, "domain-services-port")) | 239 | if (!strcmp(type, "domain-services-port")) |
@@ -285,10 +278,14 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
285 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", | 278 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", |
286 | bus_id_name); | 279 | bus_id_name); |
287 | vdev->dev_no = ~(u64)0; | 280 | vdev->dev_no = ~(u64)0; |
288 | } else { | 281 | } else if (!cfg_handle) { |
289 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", | 282 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", |
290 | bus_id_name, *id); | 283 | bus_id_name, *id); |
291 | vdev->dev_no = *id; | 284 | vdev->dev_no = *id; |
285 | } else { | ||
286 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu-%lu", | ||
287 | bus_id_name, *cfg_handle, *id); | ||
288 | vdev->dev_no = *cfg_handle; | ||
292 | } | 289 | } |
293 | 290 | ||
294 | vdev->dev.parent = parent; | 291 | vdev->dev.parent = parent; |