]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: connection: Add sysfs 'ap_cport_id' file for connections
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 7 Sep 2015 12:26:58 +0000 (17:56 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Sep 2015 04:29:01 +0000 (21:29 -0700)
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>
drivers/staging/greybus/Documentation/sysfs-bus-greybus
drivers/staging/greybus/connection.c

index 808fde96f56b6a3f36c573ebc39d8537b1b66e54..acc405456198d398b371b4dc9bca60ec2afc1682 100644 (file)
@@ -126,6 +126,14 @@ Description:
                3 - error
                4 - destroying
 
+What:          /sys/bus/greybus/device/.../ap_cport_id
+Date:          October 2015
+KernelVersion: 4.XX
+Contact:       Greg Kroah-Hartman <greg@kroah.com>
+Description:
+               The cport ID of the AP, to which cport of the module is
+               connected.
+
 What:          /sys/bus/greybus/device/.../protocol_id
 Date:          October 2015
 KernelVersion: 4.XX
index 3dcbb7832a58ed01dc898a5f4852c1d06a756af3..dc45298ad099e6c27f3fa375d5a8a6da3deddeae 100644 (file)
@@ -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,
 };