From: Johan Hovold Date: Wed, 22 Jul 2015 15:49:19 +0000 (+0200) Subject: greybus: connection: fix connection initialisation X-Git-Tag: Ubuntu-4.9.0-1.2~749^2~378^2~21^2~1343 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4e2b1e46abf4eef013ab7297a215e21d3c22004e;p=mirror_ubuntu-zesty-kernel.git 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: Johan Hovold Tested-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index feb6e496338b..4663397cb7e3 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -183,6 +183,10 @@ gb_connection_create_range(struct greybus_host_device *hd, connection->bundle = bundle; 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.bus = &greybus_bus_type; connection->dev.type = &greybus_connection_type; @@ -215,10 +219,6 @@ gb_connection_create_range(struct greybus_host_device *hd, 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 */ gb_connection_bind_protocol(connection); if (!connection->protocol)