Commit 58fb6666 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Improve VIO device naming further.

The best scheme to get uniqueness seems to be:

FOO			-- If node lacks "id" property
FOO-$(ID)		-- If node has "id" but parent lacks "cfg-handle"
FOO-$(ID)-$(CFG_HANDLE) -- If node has both
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d6e4702
...@@ -205,7 +205,8 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, ...@@ -205,7 +205,8 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
struct device_node *dp; struct device_node *dp;
struct vio_dev *vdev; struct vio_dev *vdev;
int err, tlen, clen; int err, tlen, clen;
const u64 *id; const u64 *id, *cfg_handle;
u64 a;
type = mdesc_get_property(hp, mp, "device-type", &tlen); type = mdesc_get_property(hp, mp, "device-type", &tlen);
if (!type) { if (!type) {
...@@ -221,26 +222,18 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, ...@@ -221,26 +222,18 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
return NULL; return NULL;
} }
if (!strcmp(type, "vdc-port")) { id = mdesc_get_property(hp, mp, "id", NULL);
u64 a;
id = NULL; cfg_handle = NULL;
mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) {
u64 target; u64 target;
target = mdesc_arc_target(hp, a); target = mdesc_arc_target(hp, a);
id = mdesc_get_property(hp, target, cfg_handle = mdesc_get_property(hp, target,
"cfg-handle", NULL); "cfg-handle", NULL);
if (id) if (cfg_handle)
break; break;
} }
if (!id) {
printk(KERN_ERR "VIO: vdc-port lacks parent "
"cfg-handle.\n");
return NULL;
}
} else
id = mdesc_get_property(hp, mp, "id", NULL);
bus_id_name = type; bus_id_name = type;
if (!strcmp(type, "domain-services-port")) if (!strcmp(type, "domain-services-port"))
...@@ -285,10 +278,14 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, ...@@ -285,10 +278,14 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s",
bus_id_name); bus_id_name);
vdev->dev_no = ~(u64)0; vdev->dev_no = ~(u64)0;
} else { } else if (!cfg_handle) {
snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu",
bus_id_name, *id); bus_id_name, *id);
vdev->dev_no = *id; vdev->dev_no = *id;
} else {
snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu-%lu",
bus_id_name, *cfg_handle, *id);
vdev->dev_no = *cfg_handle;
} }
vdev->dev.parent = parent; vdev->dev.parent = parent;
......
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