diff options
author | Hannes Reinecke <hare@suse.de> | 2011-06-29 16:49:57 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-07-26 05:53:50 -0400 |
commit | 0ac2377b61089e160d8e13b03cfdec89572cd741 (patch) | |
tree | cdb6bdaaf95901cb5bdbd4196917d1a7e73ca479 | |
parent | 6f8ac161b8b3332a9d96d6650ed3bae81baab30b (diff) |
[SCSI] scsi_transport_spi: Export host width and HBA id
Currently it's impossible to find out if the host supports
wide SCSI unless you're committed to trawl through syslog.
And it's near impossible to find the actual HBA id, which
is settable for some SCSI HBAs (like aic7xxx).
So export them via sysfs.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ankit Jain <jankit@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 8a172d4f4564..5fbeadd96819 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -597,6 +597,28 @@ static DEVICE_ATTR(signalling, S_IRUGO, | |||
597 | show_spi_host_signalling, | 597 | show_spi_host_signalling, |
598 | store_spi_host_signalling); | 598 | store_spi_host_signalling); |
599 | 599 | ||
600 | static ssize_t show_spi_host_width(struct device *cdev, | ||
601 | struct device_attribute *attr, | ||
602 | char *buf) | ||
603 | { | ||
604 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | ||
605 | |||
606 | return sprintf(buf, "%s\n", shost->max_id == 16 ? "wide" : "narrow"); | ||
607 | } | ||
608 | static DEVICE_ATTR(host_width, S_IRUGO, | ||
609 | show_spi_host_width, NULL); | ||
610 | |||
611 | static ssize_t show_spi_host_hba_id(struct device *cdev, | ||
612 | struct device_attribute *attr, | ||
613 | char *buf) | ||
614 | { | ||
615 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | ||
616 | |||
617 | return sprintf(buf, "%d\n", shost->this_id); | ||
618 | } | ||
619 | static DEVICE_ATTR(hba_id, S_IRUGO, | ||
620 | show_spi_host_hba_id, NULL); | ||
621 | |||
600 | #define DV_SET(x, y) \ | 622 | #define DV_SET(x, y) \ |
601 | if(i->f->set_##x) \ | 623 | if(i->f->set_##x) \ |
602 | i->f->set_##x(sdev->sdev_target, y) | 624 | i->f->set_##x(sdev->sdev_target, y) |
@@ -1380,6 +1402,8 @@ static DECLARE_ANON_TRANSPORT_CLASS(spi_device_class, | |||
1380 | 1402 | ||
1381 | static struct attribute *host_attributes[] = { | 1403 | static struct attribute *host_attributes[] = { |
1382 | &dev_attr_signalling.attr, | 1404 | &dev_attr_signalling.attr, |
1405 | &dev_attr_host_width.attr, | ||
1406 | &dev_attr_hba_id.attr, | ||
1383 | NULL | 1407 | NULL |
1384 | }; | 1408 | }; |
1385 | 1409 | ||