diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-12-03 16:41:36 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-01-02 11:22:16 -0500 |
commit | 71610f55fa4db63dbf5385929a47c9fb2451f332 (patch) | |
tree | b816672eef25e1436111e6c78053612bd22fb016 /drivers/scsi/scsi_transport_sas.c | |
parent | b58602a4bac012b5f4fc12fe6b46ab237b610d5d (diff) |
[SCSI] struct device - replace bus_id with dev_name(), dev_set_name()
[jejb: limit ioctl to returning 20 characters to avoid overrun
on long device names and add a few more conversions]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_sas.c')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 366609386be1..50988cbf7b2d 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -207,7 +207,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) | |||
207 | struct request_queue *q; | 207 | struct request_queue *q; |
208 | int error; | 208 | int error; |
209 | struct device *dev; | 209 | struct device *dev; |
210 | char namebuf[BUS_ID_SIZE]; | 210 | char namebuf[20]; |
211 | const char *name; | 211 | const char *name; |
212 | void (*release)(struct device *); | 212 | void (*release)(struct device *); |
213 | 213 | ||
@@ -219,7 +219,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) | |||
219 | if (rphy) { | 219 | if (rphy) { |
220 | q = blk_init_queue(sas_non_host_smp_request, NULL); | 220 | q = blk_init_queue(sas_non_host_smp_request, NULL); |
221 | dev = &rphy->dev; | 221 | dev = &rphy->dev; |
222 | name = dev->bus_id; | 222 | name = dev_name(dev); |
223 | release = NULL; | 223 | release = NULL; |
224 | } else { | 224 | } else { |
225 | q = blk_init_queue(sas_host_smp_request, NULL); | 225 | q = blk_init_queue(sas_host_smp_request, NULL); |
@@ -629,10 +629,10 @@ struct sas_phy *sas_phy_alloc(struct device *parent, int number) | |||
629 | INIT_LIST_HEAD(&phy->port_siblings); | 629 | INIT_LIST_HEAD(&phy->port_siblings); |
630 | if (scsi_is_sas_expander_device(parent)) { | 630 | if (scsi_is_sas_expander_device(parent)) { |
631 | struct sas_rphy *rphy = dev_to_rphy(parent); | 631 | struct sas_rphy *rphy = dev_to_rphy(parent); |
632 | sprintf(phy->dev.bus_id, "phy-%d:%d:%d", shost->host_no, | 632 | dev_set_name(&phy->dev, "phy-%d:%d:%d", shost->host_no, |
633 | rphy->scsi_target_id, number); | 633 | rphy->scsi_target_id, number); |
634 | } else | 634 | } else |
635 | sprintf(phy->dev.bus_id, "phy-%d:%d", shost->host_no, number); | 635 | dev_set_name(&phy->dev, "phy-%d:%d", shost->host_no, number); |
636 | 636 | ||
637 | transport_setup_device(&phy->dev); | 637 | transport_setup_device(&phy->dev); |
638 | 638 | ||
@@ -770,7 +770,7 @@ static void sas_port_create_link(struct sas_port *port, | |||
770 | int res; | 770 | int res; |
771 | 771 | ||
772 | res = sysfs_create_link(&port->dev.kobj, &phy->dev.kobj, | 772 | res = sysfs_create_link(&port->dev.kobj, &phy->dev.kobj, |
773 | phy->dev.bus_id); | 773 | dev_name(&phy->dev)); |
774 | if (res) | 774 | if (res) |
775 | goto err; | 775 | goto err; |
776 | res = sysfs_create_link(&phy->dev.kobj, &port->dev.kobj, "port"); | 776 | res = sysfs_create_link(&phy->dev.kobj, &port->dev.kobj, "port"); |
@@ -785,7 +785,7 @@ err: | |||
785 | static void sas_port_delete_link(struct sas_port *port, | 785 | static void sas_port_delete_link(struct sas_port *port, |
786 | struct sas_phy *phy) | 786 | struct sas_phy *phy) |
787 | { | 787 | { |
788 | sysfs_remove_link(&port->dev.kobj, phy->dev.bus_id); | 788 | sysfs_remove_link(&port->dev.kobj, dev_name(&phy->dev)); |
789 | sysfs_remove_link(&phy->dev.kobj, "port"); | 789 | sysfs_remove_link(&phy->dev.kobj, "port"); |
790 | } | 790 | } |
791 | 791 | ||
@@ -821,11 +821,11 @@ struct sas_port *sas_port_alloc(struct device *parent, int port_id) | |||
821 | 821 | ||
822 | if (scsi_is_sas_expander_device(parent)) { | 822 | if (scsi_is_sas_expander_device(parent)) { |
823 | struct sas_rphy *rphy = dev_to_rphy(parent); | 823 | struct sas_rphy *rphy = dev_to_rphy(parent); |
824 | sprintf(port->dev.bus_id, "port-%d:%d:%d", shost->host_no, | 824 | dev_set_name(&port->dev, "port-%d:%d:%d", shost->host_no, |
825 | rphy->scsi_target_id, port->port_identifier); | 825 | rphy->scsi_target_id, port->port_identifier); |
826 | } else | 826 | } else |
827 | sprintf(port->dev.bus_id, "port-%d:%d", shost->host_no, | 827 | dev_set_name(&port->dev, "port-%d:%d", shost->host_no, |
828 | port->port_identifier); | 828 | port->port_identifier); |
829 | 829 | ||
830 | transport_setup_device(&port->dev); | 830 | transport_setup_device(&port->dev); |
831 | 831 | ||
@@ -935,7 +935,7 @@ void sas_port_delete(struct sas_port *port) | |||
935 | if (port->is_backlink) { | 935 | if (port->is_backlink) { |
936 | struct device *parent = port->dev.parent; | 936 | struct device *parent = port->dev.parent; |
937 | 937 | ||
938 | sysfs_remove_link(&port->dev.kobj, parent->bus_id); | 938 | sysfs_remove_link(&port->dev.kobj, dev_name(parent)); |
939 | port->is_backlink = 0; | 939 | port->is_backlink = 0; |
940 | } | 940 | } |
941 | 941 | ||
@@ -984,7 +984,8 @@ void sas_port_add_phy(struct sas_port *port, struct sas_phy *phy) | |||
984 | /* If this trips, you added a phy that was already | 984 | /* If this trips, you added a phy that was already |
985 | * part of a different port */ | 985 | * part of a different port */ |
986 | if (unlikely(tmp != phy)) { | 986 | if (unlikely(tmp != phy)) { |
987 | dev_printk(KERN_ERR, &port->dev, "trying to add phy %s fails: it's already part of another port\n", phy->dev.bus_id); | 987 | dev_printk(KERN_ERR, &port->dev, "trying to add phy %s fails: it's already part of another port\n", |
988 | dev_name(&phy->dev)); | ||
988 | BUG(); | 989 | BUG(); |
989 | } | 990 | } |
990 | } else { | 991 | } else { |
@@ -1023,7 +1024,7 @@ void sas_port_mark_backlink(struct sas_port *port) | |||
1023 | return; | 1024 | return; |
1024 | port->is_backlink = 1; | 1025 | port->is_backlink = 1; |
1025 | res = sysfs_create_link(&port->dev.kobj, &parent->kobj, | 1026 | res = sysfs_create_link(&port->dev.kobj, &parent->kobj, |
1026 | parent->bus_id); | 1027 | dev_name(parent)); |
1027 | if (res) | 1028 | if (res) |
1028 | goto err; | 1029 | goto err; |
1029 | return; | 1030 | return; |
@@ -1367,11 +1368,12 @@ struct sas_rphy *sas_end_device_alloc(struct sas_port *parent) | |||
1367 | rdev->rphy.dev.release = sas_end_device_release; | 1368 | rdev->rphy.dev.release = sas_end_device_release; |
1368 | if (scsi_is_sas_expander_device(parent->dev.parent)) { | 1369 | if (scsi_is_sas_expander_device(parent->dev.parent)) { |
1369 | struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); | 1370 | struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); |
1370 | sprintf(rdev->rphy.dev.bus_id, "end_device-%d:%d:%d", | 1371 | dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", |
1371 | shost->host_no, rphy->scsi_target_id, parent->port_identifier); | 1372 | shost->host_no, rphy->scsi_target_id, |
1373 | parent->port_identifier); | ||
1372 | } else | 1374 | } else |
1373 | sprintf(rdev->rphy.dev.bus_id, "end_device-%d:%d", | 1375 | dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", |
1374 | shost->host_no, parent->port_identifier); | 1376 | shost->host_no, parent->port_identifier); |
1375 | rdev->rphy.identify.device_type = SAS_END_DEVICE; | 1377 | rdev->rphy.identify.device_type = SAS_END_DEVICE; |
1376 | sas_rphy_initialize(&rdev->rphy); | 1378 | sas_rphy_initialize(&rdev->rphy); |
1377 | transport_setup_device(&rdev->rphy.dev); | 1379 | transport_setup_device(&rdev->rphy.dev); |
@@ -1411,8 +1413,8 @@ struct sas_rphy *sas_expander_alloc(struct sas_port *parent, | |||
1411 | mutex_lock(&sas_host->lock); | 1413 | mutex_lock(&sas_host->lock); |
1412 | rdev->rphy.scsi_target_id = sas_host->next_expander_id++; | 1414 | rdev->rphy.scsi_target_id = sas_host->next_expander_id++; |
1413 | mutex_unlock(&sas_host->lock); | 1415 | mutex_unlock(&sas_host->lock); |
1414 | sprintf(rdev->rphy.dev.bus_id, "expander-%d:%d", | 1416 | dev_set_name(&rdev->rphy.dev, "expander-%d:%d", |
1415 | shost->host_no, rdev->rphy.scsi_target_id); | 1417 | shost->host_no, rdev->rphy.scsi_target_id); |
1416 | rdev->rphy.identify.device_type = type; | 1418 | rdev->rphy.identify.device_type = type; |
1417 | sas_rphy_initialize(&rdev->rphy); | 1419 | sas_rphy_initialize(&rdev->rphy); |
1418 | transport_setup_device(&rdev->rphy.dev); | 1420 | transport_setup_device(&rdev->rphy.dev); |
@@ -1445,7 +1447,7 @@ int sas_rphy_add(struct sas_rphy *rphy) | |||
1445 | transport_add_device(&rphy->dev); | 1447 | transport_add_device(&rphy->dev); |
1446 | transport_configure_device(&rphy->dev); | 1448 | transport_configure_device(&rphy->dev); |
1447 | if (sas_bsg_initialize(shost, rphy)) | 1449 | if (sas_bsg_initialize(shost, rphy)) |
1448 | printk("fail to a bsg device %s\n", rphy->dev.bus_id); | 1450 | printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); |
1449 | 1451 | ||
1450 | 1452 | ||
1451 | mutex_lock(&sas_host->lock); | 1453 | mutex_lock(&sas_host->lock); |