From 91ba3c2128e9ee490a9f04bcd5b54749b18e4410 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 18 Jul 2007 15:15:45 -0700 Subject: [SPARC64]: Fix handling of multiple vdc-port nodes. The "id" property in vdc-port nodes are not unique, they are all zero. Therefore assign ID's using the parent's "cfg-handle" property which will be unique. Signed-off-by: David S. Miller --- drivers/block/sunvdc.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 4ee3920b05c..d50b8238115 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c @@ -64,7 +64,6 @@ struct vdc_port { u64 operations; u32 vdisk_size; u8 vdisk_type; - u8 dev_no; char disk_name[32]; @@ -703,7 +702,7 @@ static int probe_disk(struct vdc_port *port) blk_queue_max_phys_segments(q, port->ring_cookies); blk_queue_max_sectors(q, port->max_xfer_size); g->major = vdc_major; - g->first_minor = port->dev_no << PARTITION_SHIFT; + g->first_minor = port->vio.vdev->dev_no << PARTITION_SHIFT; strcpy(g->disk_name, port->disk_name); g->fops = &vdc_fops; @@ -747,21 +746,16 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev, { struct mdesc_handle *hp; struct vdc_port *port; - const u64 *port_id; int err; print_version(); hp = mdesc_grab(); - port_id = mdesc_get_property(hp, vdev->mp, "id", NULL); err = -ENODEV; - if (!port_id) { - printk(KERN_ERR PFX "Port lacks id property.\n"); - goto err_out_release_mdesc; - } - if ((*port_id << PARTITION_SHIFT) & ~(u64)MINORMASK) { - printk(KERN_ERR PFX "Port id [%lu] too large.\n", *port_id); + if ((vdev->dev_no << PARTITION_SHIFT) & ~(u64)MINORMASK) { + printk(KERN_ERR PFX "Port id [%lu] too large.\n", + vdev->dev_no); goto err_out_release_mdesc; } @@ -772,16 +766,14 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev, goto err_out_release_mdesc; } - port->dev_no = *port_id; - - if (port->dev_no >= 26) + if (vdev->dev_no >= 26) snprintf(port->disk_name, sizeof(port->disk_name), VDCBLK_NAME "%c%c", - 'a' + (port->dev_no / 26) - 1, - 'a' + (port->dev_no % 26)); + 'a' + ((int)vdev->dev_no / 26) - 1, + 'a' + ((int)vdev->dev_no % 26)); else snprintf(port->disk_name, sizeof(port->disk_name), - VDCBLK_NAME "%c", 'a' + (port->dev_no % 26)); + VDCBLK_NAME "%c", 'a' + ((int)vdev->dev_no % 26)); err = vio_driver_init(&port->vio, vdev, VDEV_DISK, vdc_versions, ARRAY_SIZE(vdc_versions), -- cgit v1.2.3