summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/core.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-01-21 17:34:09 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-21 22:45:09 -0800
commit98fdf5a037f0789f1ea6e22431a4a4cc7c41829d (patch)
tree8d7cb053d2dfdce35334440311b53d5edf755d77 /drivers/staging/greybus/core.c
parent6ce4cc278deca9849bd54783294be7edbe24bac0 (diff)
greybus: core: defer connection creation to driver probe
Defer connection creation to bundle driver probe instead of creating them when initialising the interface and parsing the manifest. Store copies of the CPorts descriptors in the bundle for the drivers to use, and update the legacy driver. This is needed for drivers that need more control over host-device resource management, for example, when a protocol needs to use a dedicated host CPort for traffic offloading (e.g. camera data). This also avoids allocating host CPorts for bundles that are not bound to a driver or for remote CPorts that a driver does not need. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/core.c')
-rw-r--r--drivers/staging/greybus/core.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index 1bb685bae7d2..b9303c0cd5e4 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -151,8 +151,14 @@ static int greybus_probe(struct device *dev)
return -ENODEV;
retval = driver->probe(bundle, id);
- if (retval)
+ if (retval) {
+ /*
+ * Catch buggy drivers that fail to destroy their connections.
+ */
+ WARN_ON(!list_empty(&bundle->connections));
+
return retval;
+ }
return 0;
}
@@ -172,11 +178,8 @@ static int greybus_remove(struct device *dev)
driver->disconnect(bundle);
- /* Catch buggy drivers that fail to disable their connections. */
- list_for_each_entry(connection, &bundle->connections, bundle_links) {
- if (WARN_ON(connection->state != GB_CONNECTION_STATE_DISABLED))
- gb_connection_disable(connection);
- }
+ /* Catch buggy drivers that fail to destroy their connections. */
+ WARN_ON(!list_empty(&bundle->connections));
return 0;
}