mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
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>
This commit is contained in:
parent
eb9e2bc80d
commit
e7e3ce0458
1 changed files with 13 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue