]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: hpsa: add 'ctlr_num' sysfs attribute
authorHannes Reinecke <hare@suse.de>
Fri, 18 Nov 2016 07:32:49 +0000 (08:32 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 20:17:52 +0000 (12:17 -0800)
Add a sysfs attribute 'ctlr_num' holding the current HPSA controller
number. This is required to construct compability 'cciss' links.

[mkp: fixed typo]

Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 25605941
(cherry picked from commit 16961204a0ebcb87b89ed3be14b0a484c754d7e4)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
drivers/scsi/hpsa.c

index fcde1d2203f338b1517ef20a5716cf4f37608d75..b1cfd652bb01734ffa62cce346774cab4e670545 100644 (file)
@@ -867,6 +867,16 @@ static ssize_t path_info_show(struct device *dev,
        return output_len;
 }
 
+static ssize_t host_show_ctlr_num(struct device *dev,
+       struct device_attribute *attr, char *buf)
+{
+       struct ctlr_info *h;
+       struct Scsi_Host *shost = class_to_shost(dev);
+
+       h = shost_to_hba(shost);
+       return snprintf(buf, 20, "%d\n", h->ctlr);
+}
+
 static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
 static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
 static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
@@ -890,6 +900,8 @@ static DEVICE_ATTR(resettable, S_IRUGO,
        host_show_resettable, NULL);
 static DEVICE_ATTR(lockup_detected, S_IRUGO,
        host_show_lockup_detected, NULL);
+static DEVICE_ATTR(ctlr_num, S_IRUGO,
+       host_show_ctlr_num, NULL);
 
 static struct device_attribute *hpsa_sdev_attrs[] = {
        &dev_attr_raid_level,
@@ -910,6 +922,7 @@ static struct device_attribute *hpsa_shost_attrs[] = {
        &dev_attr_hp_ssd_smart_path_status,
        &dev_attr_raid_offload_debug,
        &dev_attr_lockup_detected,
+       &dev_attr_ctlr_num,
        NULL,
 };