diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-04-01 20:32:01 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-04-06 11:34:39 +0200 |
commit | bb97ea813b1c31a0fc78af3d06a8dbd793ea372b (patch) | |
tree | 79dcc69cf77771ba04b715644e52cabf342149fb /drivers/staging/greybus/bundle.c | |
parent | 7c183f70ed5b1fa368559031b1ef2245827f2918 (diff) | |
download | op-kernel-dev-bb97ea813b1c31a0fc78af3d06a8dbd793ea372b.zip op-kernel-dev-bb97ea813b1c31a0fc78af3d06a8dbd793ea372b.tar.gz |
greybus: bundle: Initialize all bundles on link-up
An interface can have 1 or more bundles. On link-up event, we must initialize
all the bundles associated with the interface.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/bundle.c')
-rw-r--r-- | drivers/staging/greybus/bundle.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 47a3413..9691978 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -146,16 +146,11 @@ void gb_bundle_destroy(struct gb_interface *intf) } } -int gb_bundle_init(struct gb_interface *intf, u8 bundle_id, u8 device_id) +int gb_bundle_init(struct gb_bundle *bundle, u8 device_id) { - struct gb_bundle *bundle; + struct gb_interface *intf = bundle->intf; int ret; - bundle = gb_bundle_find(intf, bundle_id); - if (!bundle) { - dev_err(intf->hd->parent, "bundle %hhu not found\n", bundle_id); - return -ENOENT; - } bundle->device_id = device_id; ret = svc_set_route_send(bundle, intf->hd); @@ -175,6 +170,24 @@ int gb_bundle_init(struct gb_interface *intf, u8 bundle_id, u8 device_id) return 0; } +int gb_bundles_init(struct gb_interface *intf, u8 device_id) +{ + struct gb_bundle *bundle; + int ret = 0; + + list_for_each_entry(bundle, &intf->bundles, links) { + ret = gb_bundle_init(bundle, device_id); + if (ret) { + dev_err(intf->hd->parent, + "Failed to initialize bundle %hhu\n", + bundle->id); + break; + } + } + + return ret; +} + struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id) { struct gb_bundle *bundle; |