diff options
author | Andrey Shvetsov <andrey.shvetsov@k2l.de> | 2017-11-21 15:05:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-27 09:20:37 +0100 |
commit | e7e3ce04588c7f4919627f0742bc6cbe832036a4 (patch) | |
tree | b1e0f7cb50ecd161dbef03ec93ae72d171a0a279 /drivers/staging/most | |
parent | eb9e2bc80d1451b116f9964a84a49f89d38b1e05 (diff) | |
download | linux-stable-e7e3ce04588c7f4919627f0742bc6cbe832036a4.tar.gz linux-stable-e7e3ce04588c7f4919627f0742bc6cbe832036a4.tar.bz2 linux-stable-e7e3ce04588c7f4919627f0742bc6cbe832036a4.zip |
staging: most: core: fix list traversing
This patch fixes the offset and data handling when traversing
the list of devices that are attached to the bus.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/core.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index bfd1a028ccad..c1fba5ba7541 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -529,10 +529,16 @@ static struct core_component *match_component(char *name) return NULL; } +struct show_links_data { + int offs; + char *buf; +}; + int print_links(struct device *dev, void *data) { - int offs = 0; - char *buf = data; + struct show_links_data *d = data; + int offs = d->offs; + char *buf = d->buf; struct most_channel *c; struct most_interface *iface = to_most_interface(dev); @@ -554,13 +560,16 @@ int print_links(struct device *dev, void *data) dev_name(&c->dev)); } } + d->offs = offs; return 0; } static ssize_t links_show(struct device_driver *drv, char *buf) { - bus_for_each_dev(&mc.bus, NULL, buf, print_links); - return strlen(buf); + struct show_links_data d = { .buf = buf }; + + bus_for_each_dev(&mc.bus, NULL, &d, print_links); + return d.offs; } static ssize_t components_show(struct device_driver *drv, char *buf) |