summaryrefslogtreecommitdiffstats
path: root/drivers/misc/enclosure.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2014-12-30 14:46:16 -0800
committerChristoph Hellwig <hch@lst.de>2015-01-09 15:44:18 +0100
commit967f7bab0eaaa74d7d01a56d45aa309f78fb87dd (patch)
treec060248c671d1d2882458941d5de40a1dc7441cd /drivers/misc/enclosure.c
parent15a0fbbc8e0d4c135b069c34258fbaebad471dd7 (diff)
downloadlinux-967f7bab0eaaa74d7d01a56d45aa309f78fb87dd.tar.bz2
ses: add enclosure logical id
Export the NAA logical id for the enclosure. This is optionally available from the sas_transport_class, but it is really a property of the enclosure. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Song Liu <songliubraving@fb.com> Reviewed-by: Jens Axboe <axboe@fb.com> Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/misc/enclosure.c')
-rw-r--r--drivers/misc/enclosure.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index e18278aa6bbb..958ee988a1e1 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -432,8 +432,21 @@ static ssize_t components_show(struct device *cdev,
}
static DEVICE_ATTR_RO(components);
+static ssize_t id_show(struct device *cdev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct enclosure_device *edev = to_enclosure_device(cdev);
+
+ if (edev->cb->show_id)
+ return edev->cb->show_id(edev, buf);
+ return -EINVAL;
+}
+static DEVICE_ATTR_RO(id);
+
static struct attribute *enclosure_class_attrs[] = {
&dev_attr_components.attr,
+ &dev_attr_id.attr,
NULL,
};
ATTRIBUTE_GROUPS(enclosure_class);