diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-01-21 17:34:21 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-01-21 22:46:38 -0800 |
commit | f7ee081e3151e187e7478eb8941f61744f125201 (patch) | |
tree | 7cc0f73f1a5b6f78033029f43e406762ba1a9d66 /drivers/staging/greybus/legacy.c | |
parent | 2399032d7262f2a5dc1f22380d23b17971ed22e4 (diff) |
greybus: connection: set request handlers at creation
Set the connection request handler at creation rather than when enabling
the connection.
This is possible now that connections are created by the drivers that
use them rather than by core at manifest parsing 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 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/staging/greybus/legacy.c b/drivers/staging/greybus/legacy.c index 4f3476c45d3a..18f1a2b043a3 100644 --- a/drivers/staging/greybus/legacy.c +++ b/drivers/staging/greybus/legacy.c @@ -49,18 +49,12 @@ static int legacy_request_handler(struct gb_operation *operation) static int legacy_connection_init(struct legacy_connection *lc) { struct gb_connection *connection = lc->connection; - gb_request_handler_t handler; int ret; dev_dbg(&connection->bundle->dev, "%s - %s\n", __func__, connection->name); - if (connection->protocol->request_recv) - handler = legacy_request_handler; - else - handler = NULL; - - ret = gb_connection_enable(connection, handler); + ret = gb_connection_enable(connection); if (ret) return ret; @@ -102,6 +96,7 @@ static int legacy_connection_create(struct legacy_connection *lc, { struct gb_connection *connection; struct gb_protocol *protocol; + gb_request_handler_t handler; u8 major, minor; int ret; @@ -122,7 +117,13 @@ static int legacy_connection_create(struct legacy_connection *lc, return -EPROTONOSUPPORT; } - connection = gb_connection_create(bundle, le16_to_cpu(desc->id)); + if (protocol->request_recv) + handler = legacy_request_handler; + else + handler = NULL; + + connection = gb_connection_create(bundle, le16_to_cpu(desc->id), + handler); if (IS_ERR(connection)) { ret = PTR_ERR(connection); goto err_protocol_put; |