aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/sunvdc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-18 18:15:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-20 00:27:18 -0400
commit91ba3c2128e9ee490a9f04bcd5b54749b18e4410 (patch)
treec90f5711b990468dc684a8859cc9c498b8d4163d /drivers/block/sunvdc.c
parent48db7b7c50cdb06c85f0ff01b5c19ac34903048b (diff)
[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 <davem@davemloft.net>
Diffstat (limited to 'drivers/block/sunvdc.c')
-rw-r--r--drivers/block/sunvdc.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 4ee3920b05cc..d50b82381155 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -64,7 +64,6 @@ struct vdc_port {
64 u64 operations; 64 u64 operations;
65 u32 vdisk_size; 65 u32 vdisk_size;
66 u8 vdisk_type; 66 u8 vdisk_type;
67 u8 dev_no;
68 67
69 char disk_name[32]; 68 char disk_name[32];
70 69
@@ -703,7 +702,7 @@ static int probe_disk(struct vdc_port *port)
703 blk_queue_max_phys_segments(q, port->ring_cookies); 702 blk_queue_max_phys_segments(q, port->ring_cookies);
704 blk_queue_max_sectors(q, port->max_xfer_size); 703 blk_queue_max_sectors(q, port->max_xfer_size);
705 g->major = vdc_major; 704 g->major = vdc_major;
706 g->first_minor = port->dev_no << PARTITION_SHIFT; 705 g->first_minor = port->vio.vdev->dev_no << PARTITION_SHIFT;
707 strcpy(g->disk_name, port->disk_name); 706 strcpy(g->disk_name, port->disk_name);
708 707
709 g->fops = &vdc_fops; 708 g->fops = &vdc_fops;
@@ -747,21 +746,16 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
747{ 746{
748 struct mdesc_handle *hp; 747 struct mdesc_handle *hp;
749 struct vdc_port *port; 748 struct vdc_port *port;
750 const u64 *port_id;
751 int err; 749 int err;
752 750
753 print_version(); 751 print_version();
754 752
755 hp = mdesc_grab(); 753 hp = mdesc_grab();
756 754
757 port_id = mdesc_get_property(hp, vdev->mp, "id", NULL);
758 err = -ENODEV; 755 err = -ENODEV;
759 if (!port_id) { 756 if ((vdev->dev_no << PARTITION_SHIFT) & ~(u64)MINORMASK) {
760 printk(KERN_ERR PFX "Port lacks id property.\n"); 757 printk(KERN_ERR PFX "Port id [%lu] too large.\n",
761 goto err_out_release_mdesc; 758 vdev->dev_no);
762 }
763 if ((*port_id << PARTITION_SHIFT) & ~(u64)MINORMASK) {
764 printk(KERN_ERR PFX "Port id [%lu] too large.\n", *port_id);
765 goto err_out_release_mdesc; 759 goto err_out_release_mdesc;
766 } 760 }
767 761
@@ -772,16 +766,14 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
772 goto err_out_release_mdesc; 766 goto err_out_release_mdesc;
773 } 767 }
774 768
775 port->dev_no = *port_id; 769 if (vdev->dev_no >= 26)
776
777 if (port->dev_no >= 26)
778 snprintf(port->disk_name, sizeof(port->disk_name), 770 snprintf(port->disk_name, sizeof(port->disk_name),
779 VDCBLK_NAME "%c%c", 771 VDCBLK_NAME "%c%c",
780 'a' + (port->dev_no / 26) - 1, 772 'a' + ((int)vdev->dev_no / 26) - 1,
781 'a' + (port->dev_no % 26)); 773 'a' + ((int)vdev->dev_no % 26));
782 else 774 else
783 snprintf(port->disk_name, sizeof(port->disk_name), 775 snprintf(port->disk_name, sizeof(port->disk_name),
784 VDCBLK_NAME "%c", 'a' + (port->dev_no % 26)); 776 VDCBLK_NAME "%c", 'a' + ((int)vdev->dev_no % 26));
785 777
786 err = vio_driver_init(&port->vio, vdev, VDEV_DISK, 778 err = vio_driver_init(&port->vio, vdev, VDEV_DISK,
787 vdc_versions, ARRAY_SIZE(vdc_versions), 779 vdc_versions, ARRAY_SIZE(vdc_versions),