diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-01-21 17:34:18 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-01-21 22:46:38 -0800 |
commit | 8278fae5d727b02af2fb7e1ac518c63569096c9f (patch) | |
tree | 440c7e3911591e8e18c2f822020cf8a71e477dd0 /drivers/staging/greybus/legacy.c | |
parent | 431b3ebb3d9e0c25081006fc7a1f97621dca6192 (diff) |
greybus: legacy: add initialized flag
Add initialized flag and use instead of the connection protocol pointer
to determine when the legacy connection has been initialised.
This is a step in moving legacy connection binding to
connection-creation time.
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/legacy.c')
-rw-r--r-- | drivers/staging/greybus/legacy.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/greybus/legacy.c b/drivers/staging/greybus/legacy.c index 37c421248611..c7f59e4f5b8e 100644 --- a/drivers/staging/greybus/legacy.c +++ b/drivers/staging/greybus/legacy.c @@ -14,6 +14,7 @@ struct legacy_connection { struct gb_connection *connection; + bool initialized; }; struct legacy_data { @@ -112,6 +113,8 @@ static int legacy_connection_init(struct legacy_connection *lc) if (ret) goto err_disable; + lc->initialized = true; + return 0; err_disable: @@ -126,7 +129,7 @@ static void legacy_connection_exit(struct legacy_connection *lc) { struct gb_connection *connection = lc->connection; - if (!connection->protocol) + if (!lc->initialized) return; gb_connection_disable(connection); @@ -134,6 +137,8 @@ static void legacy_connection_exit(struct legacy_connection *lc) connection->protocol->connection_exit(connection); legacy_connection_unbind_protocol(connection); + + lc->initialized = false; } static int legacy_connection_create(struct legacy_connection *lc, |