summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2016-09-12 16:26:13 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-13 15:01:29 +0200
commitbc5f96a15658f390aba8688408526542c9329d7e (patch)
treeaa5d84e5018871a16e367031a5c797fd16a79e81
parent25b80dbe3fa6d76d8f19af0623d1fd8ed0dd671e (diff)
downloadop-kernel-dev-bc5f96a15658f390aba8688408526542c9329d7e.zip
op-kernel-dev-bc5f96a15658f390aba8688408526542c9329d7e.tar.gz
staging: most: core: show all linked channels
This patch is needed to have all linked channels being reported by the show() function of the attribute file add_link. Currently user space can only read back the latest link that has been established to a certain channel. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/most/mostcore/core.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index db0606ca..bd555ec 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -848,7 +848,23 @@ static ssize_t show_add_link(struct most_aim_obj *aim_obj,
struct most_aim_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%s\n", aim_obj->add_link);
+ struct most_c_obj *c;
+ struct most_inst_obj *i;
+ int offs = 0;
+
+ list_for_each_entry(i, &instance_list, list) {
+ list_for_each_entry(c, &i->channel_list, list) {
+ if (c->aim0.ptr == aim_obj->driver ||
+ c->aim1.ptr == aim_obj->driver) {
+ offs += snprintf(buf + offs, PAGE_SIZE - offs,
+ "%s:%s\n",
+ kobject_name(&i->kobj),
+ kobject_name(&c->kobj));
+ }
+ }
+ }
+
+ return offs;
}
/**
OpenPOWER on IntegriCloud