summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/bundle.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-11-25 15:59:01 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-11-25 15:27:06 -0800
commita97015c9e99d8421b80cdf9652a456f4cd93fc1e (patch)
tree6bf1367f603b3e9696e5d900d7f22cad8a155429 /drivers/staging/greybus/bundle.c
parent2b14daba1d6976a078ba8ccdd1f932f2320061a8 (diff)
greybus: bundle: add bundle_id attribute
Add a bundle_id attribute for the interface-unique id of a bundle that user space can use for matching. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/bundle.c')
-rw-r--r--drivers/staging/greybus/bundle.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c
index 61c9a6d68561..f746438bc962 100644
--- a/drivers/staging/greybus/bundle.c
+++ b/drivers/staging/greybus/bundle.c
@@ -18,6 +18,15 @@ static ssize_t bundle_class_show(struct device *dev,
}
static DEVICE_ATTR_RO(bundle_class);
+static ssize_t bundle_id_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gb_bundle *bundle = to_gb_bundle(dev);
+
+ return sprintf(buf, "%u\n", bundle->id);
+}
+static DEVICE_ATTR_RO(bundle_id);
+
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -49,6 +58,7 @@ static DEVICE_ATTR_RW(state);
static struct attribute *bundle_attrs[] = {
&dev_attr_bundle_class.attr,
+ &dev_attr_bundle_id.attr,
&dev_attr_state.attr,
NULL,
};