diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-07-24 15:32:19 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-07-24 16:33:20 -0700 |
commit | 67c93ae6f544a0953d1159ffcc0dd14bea77fc53 (patch) | |
tree | 7e12207b80d186498cfb5f9ba4c0c26f69e90fa6 /drivers/staging/greybus/connection.c | |
parent | 3dfe8aaaeede22b0601c95cf1a4c2eadcb3851ba (diff) | |
download | linux-stable-67c93ae6f544a0953d1159ffcc0dd14bea77fc53.tar.gz linux-stable-67c93ae6f544a0953d1159ffcc0dd14bea77fc53.tar.bz2 linux-stable-67c93ae6f544a0953d1159ffcc0dd14bea77fc53.zip |
greybus: svc: fully initialize the partially initialized connection
SVC hello message is received now and we should fully initialize the
partially initialized connection. This can be done by removing and
re-adding the device corresponding to the connection.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r-- | drivers/staging/greybus/connection.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index b88abed2e1ad..0cd716d58a3a 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -111,6 +111,30 @@ struct device_type greybus_connection_type = { }; +int svc_update_connection(struct gb_interface *intf, + struct gb_connection *connection) +{ + struct gb_bundle *bundle; + + bundle = gb_bundle_create(intf, GB_SVC_BUNDLE_ID, GREYBUS_CLASS_SVC); + if (!bundle) + return -EINVAL; + + device_del(&connection->dev); + connection->bundle = bundle; + connection->dev.parent = &bundle->dev; + dev_set_name(&connection->dev, "%s:%d", dev_name(&bundle->dev), + GB_SVC_CPORT_ID); + + WARN_ON(device_add(&connection->dev)); + + spin_lock_irq(&gb_connections_lock); + list_add(&connection->bundle_links, &bundle->connections); + spin_unlock_irq(&gb_connections_lock); + + return 0; +} + void gb_connection_bind_protocol(struct gb_connection *connection) { struct gb_protocol *protocol; |