summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-09-07 17:56:58 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-09-14 21:29:01 -0700
commit8552ca0f3634bf6aaf8f752fb9a73652326117eb (patch)
treec3eab25d80bbb0d06cbdc33eff4787e811b56ce6 /drivers/staging/greybus/connection.c
parent0a020570ed2f7817998870a9451526ffe492c44a (diff)
downloadlinux-stable-8552ca0f3634bf6aaf8f752fb9a73652326117eb.tar.gz
linux-stable-8552ca0f3634bf6aaf8f752fb9a73652326117eb.tar.bz2
linux-stable-8552ca0f3634bf6aaf8f752fb9a73652326117eb.zip
greybus: connection: Add sysfs 'ap_cport_id' file for connections
Its a very useful piece of information, i.e. the cport id of the AP to which the cport of the module is connected, and is required lots of times. It isn't known in advance as it is allocated at runtime. This patch creates another file 'ap_cport_id', only for the connection directories, which will give the cport id of the AP. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 3dcbb7832a58..dc45298ad099 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -116,9 +116,18 @@ protocol_id_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR_RO(protocol_id);
+static ssize_t
+ap_cport_id_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct gb_connection *connection = to_gb_connection(dev);
+ return sprintf(buf, "%hu\n", connection->hd_cport_id);
+}
+static DEVICE_ATTR_RO(ap_cport_id);
+
static struct attribute *connection_attrs[] = {
&dev_attr_state.attr,
&dev_attr_protocol_id.attr,
+ &dev_attr_ap_cport_id.attr,
NULL,
};