Commit 4e2b1e46 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: connection: fix connection initialisation

Make sure connection is fully initialised before registering the
connection device and adding it to the host-device and bundle lists.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Tested-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent a4e08469
...@@ -183,6 +183,10 @@ gb_connection_create_range(struct greybus_host_device *hd, ...@@ -183,6 +183,10 @@ gb_connection_create_range(struct greybus_host_device *hd,
connection->bundle = bundle; connection->bundle = bundle;
connection->state = GB_CONNECTION_STATE_DISABLED; connection->state = GB_CONNECTION_STATE_DISABLED;
atomic_set(&connection->op_cycle, 0);
spin_lock_init(&connection->lock);
INIT_LIST_HEAD(&connection->operations);
connection->dev.parent = parent; connection->dev.parent = parent;
connection->dev.bus = &greybus_bus_type; connection->dev.bus = &greybus_bus_type;
connection->dev.type = &greybus_connection_type; connection->dev.type = &greybus_connection_type;
...@@ -215,10 +219,6 @@ gb_connection_create_range(struct greybus_host_device *hd, ...@@ -215,10 +219,6 @@ gb_connection_create_range(struct greybus_host_device *hd,
spin_unlock_irq(&gb_connections_lock); spin_unlock_irq(&gb_connections_lock);
atomic_set(&connection->op_cycle, 0);
spin_lock_init(&connection->lock);
INIT_LIST_HEAD(&connection->operations);
/* XXX Will have to establish connections to get version */ /* XXX Will have to establish connections to get version */
gb_connection_bind_protocol(connection); gb_connection_bind_protocol(connection);
if (!connection->protocol) if (!connection->protocol)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment