From: Johan Hovold Date: Wed, 25 Nov 2015 14:59:01 +0000 (+0100) Subject: greybus: bundle: add bundle_id attribute X-Git-Tag: v4.14-rc1~2366^2~378^2~21^2~1012 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a97015c9e99d8421b80cdf9652a456f4cd93fc1e;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/Documentation/sysfs-bus-greybus b/drivers/staging/greybus/Documentation/sysfs-bus-greybus index 88ed2d8..9329a31 100644 --- a/drivers/staging/greybus/Documentation/sysfs-bus-greybus +++ b/drivers/staging/greybus/Documentation/sysfs-bus-greybus @@ -104,6 +104,13 @@ Contact: Greg Kroah-Hartman Description: The greybus class of the bundle B. +What: /sys/bus/greybus/device/N-I.B/bundle_id +Date: October 2015 +KernelVersion: 4.XX +Contact: Greg Kroah-Hartman +Description: + The interface-unique id of the bundle B. + What: /sys/bus/greybus/device/N-I.B/state Date: October 2015 KernelVersion: 4.XX diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 61c9a6d..f746438 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, };