Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Hannes Reinecke and committed by
James Bottomley
0ac2377b 6f8ac161

+24
+24
drivers/scsi/scsi_transport_spi.c
··· 597 597 show_spi_host_signalling, 598 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 622 #define DV_SET(x, y) \ 601 623 if(i->f->set_##x) \ 602 624 i->f->set_##x(sdev->sdev_target, y) ··· 1402 1380 1403 1381 static struct attribute *host_attributes[] = { 1404 1382 &dev_attr_signalling.attr, 1383 + &dev_attr_host_width.attr, 1384 + &dev_attr_hba_id.attr, 1405 1385 NULL 1406 1386 }; 1407 1387