All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi_transport_spi: Export host width and HBA id
@ 2011-06-22 13:14 Ankit Jain
  0 siblings, 0 replies; only message in thread
From: Ankit Jain @ 2011-06-22 13:14 UTC (permalink / raw)
  To: James Bottomley; +Cc: Hannes Reinecke, linux-scsi

This is a slightly updated version of the patch which Hannes had
posted earlier. This changes the host attr name from "width" to
"host_width", as there already exists an attribute named "width".

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

---
 drivers/scsi/scsi_transport_spi.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Index: linux-2.6.32-sle11-sp1/drivers/scsi/scsi_transport_spi.c
===================================================================
--- linux-2.6.32-sle11-sp1.orig/drivers/scsi/scsi_transport_spi.c
+++ linux-2.6.32-sle11-sp1/drivers/scsi/scsi_transport_spi.c
@@ -596,6 +596,28 @@ static DEVICE_ATTR(signalling, S_IRUGO,
 		   show_spi_host_signalling,
 		   store_spi_host_signalling);
 
+static ssize_t show_spi_host_width(struct device *cdev,
+				      struct device_attribute *attr,
+				      char *buf)
+{
+	struct Scsi_Host *shost = transport_class_to_shost(cdev);
+
+	return sprintf(buf, "%s\n", shost->max_id == 16 ? "wide" : "narrow");
+}
+static DEVICE_ATTR(host_width, S_IRUGO,
+		   show_spi_host_width, NULL);
+
+static ssize_t show_spi_host_hba_id(struct device *cdev,
+				    struct device_attribute *attr,
+				    char *buf)
+{
+	struct Scsi_Host *shost = transport_class_to_shost(cdev);
+
+	return sprintf(buf, "%d\n", shost->this_id);
+}
+static DEVICE_ATTR(hba_id, S_IRUGO,
+		   show_spi_host_hba_id, NULL);
+
 #define DV_SET(x, y)			\
 	if(i->f->set_##x)		\
 		i->f->set_##x(sdev->sdev_target, y)
@@ -1379,6 +1401,8 @@ static DECLARE_ANON_TRANSPORT_CLASS(spi_
 
 static struct attribute *host_attributes[] = {
 	&dev_attr_signalling.attr,
+	&dev_attr_host_width.attr,
+	&dev_attr_hba_id.attr,
 	NULL
 };
 
-- 
Ankit Jain
SUSE Labs

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-22 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-22 13:14 [PATCH v2] scsi_transport_spi: Export host width and HBA id Ankit Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.