summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-01-19 12:51:16 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-19 12:17:13 -0800
commit50dfb87865790bf8ef86a1c6898cde4e0df212fd (patch)
treedcc58670085cc25125e5cd1c8479fd2440afd8f5 /drivers/staging/greybus/connection.c
parent84427943d2da5f55d5cc83d83ba2a75c2079d1dd (diff)
downloadlinux-stable-50dfb87865790bf8ef86a1c6898cde4e0df212fd.tar.gz
linux-stable-50dfb87865790bf8ef86a1c6898cde4e0df212fd.tar.bz2
linux-stable-50dfb87865790bf8ef86a1c6898cde4e0df212fd.zip
greybus: connection: move legacy-protocol handling to legacy driver
Move legacy protocol and connection handling to the legacy driver. Rename the former global functions using a common legacy_ prefix. Note that all legacy protocols suffer from a connection initialisation race in that the protocol-specific initialisation, which includes allocation of protocol-specific state containers, can not happen until *after* the connection has been enabled. This is a major flaw in the original design that we can now finally address by converting the legacy protocol drivers into proper bundle (class) drivers. 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/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c107
1 files changed, 0 insertions, 107 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 3339ef956788..7a967befc897 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -12,10 +12,6 @@
#include "greybus.h"
-static int gb_connection_bind_protocol(struct gb_connection *connection);
-static void gb_connection_unbind_protocol(struct gb_connection *connection);
-
-
static DEFINE_SPINLOCK(gb_connections_lock);
/* This is only used at initialization time; no locking is required. */
@@ -341,24 +337,6 @@ gb_connection_control_disconnected(struct gb_connection *connection)
}
/*
- * Request protocol version supported by the module.
- */
-static int gb_connection_protocol_get_version(struct gb_connection *connection)
-{
- int ret;
-
- ret = gb_protocol_get_version(connection);
- if (ret) {
- dev_err(&connection->hd->dev,
- "%s: failed to get protocol version: %d\n",
- connection->name, ret);
- return ret;
- }
-
- return 0;
-}
-
-/*
* Cancel all active operations on a connection.
*
* Locking: Called with connection lock held and state set to DISABLED.
@@ -526,63 +504,6 @@ out_unlock:
}
EXPORT_SYMBOL_GPL(gb_connection_disable);
-static int gb_legacy_request_handler(struct gb_operation *operation)
-{
- struct gb_protocol *protocol = operation->connection->protocol;
-
- return protocol->request_recv(operation->type, operation);
-}
-
-int gb_connection_legacy_init(struct gb_connection *connection)
-{
- gb_request_handler_t handler;
- int ret;
-
- ret = gb_connection_bind_protocol(connection);
- if (ret)
- return ret;
-
- if (connection->protocol->request_recv)
- handler = gb_legacy_request_handler;
- else
- handler = NULL;
-
- ret = gb_connection_enable(connection, handler);
- if (ret)
- goto err_unbind_protocol;
-
- ret = gb_connection_protocol_get_version(connection);
- if (ret)
- goto err_disable;
-
- ret = connection->protocol->connection_init(connection);
- if (ret)
- goto err_disable;
-
- return 0;
-
-err_disable:
- gb_connection_disable(connection);
-err_unbind_protocol:
- gb_connection_unbind_protocol(connection);
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(gb_connection_legacy_init);
-
-void gb_connection_legacy_exit(struct gb_connection *connection)
-{
- if (connection->state == GB_CONNECTION_STATE_DISABLED)
- return;
-
- gb_connection_disable(connection);
-
- connection->protocol->connection_exit(connection);
-
- gb_connection_unbind_protocol(connection);
-}
-EXPORT_SYMBOL_GPL(gb_connection_legacy_exit);
-
/*
* Tear down a previously set up connection.
*/
@@ -639,31 +560,3 @@ void gb_connection_latency_tag_disable(struct gb_connection *connection)
}
}
EXPORT_SYMBOL_GPL(gb_connection_latency_tag_disable);
-
-static int gb_connection_bind_protocol(struct gb_connection *connection)
-{
- struct gb_protocol *protocol;
-
- protocol = gb_protocol_get(connection->protocol_id,
- connection->major,
- connection->minor);
- if (!protocol) {
- dev_err(&connection->hd->dev,
- "protocol 0x%02x version %u.%u not found\n",
- connection->protocol_id,
- connection->major, connection->minor);
- return -EPROTONOSUPPORT;
- }
- connection->protocol = protocol;
-
- return 0;
-}
-
-static void gb_connection_unbind_protocol(struct gb_connection *connection)
-{
- struct gb_protocol *protocol = connection->protocol;
-
- gb_protocol_put(protocol);
-
- connection->protocol = NULL;
-}