summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/connection.h
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2014-10-27 06:04:30 -0500
committerGreg Kroah-Hartman <greg@kroah.com>2014-10-28 09:47:09 +0800
commit3689f9744a029ee9b7b38fb177249d2812ffa676 (patch)
tree258fa9a68247a24a74e2363a2e2dc7057cab5c35 /drivers/staging/greybus/connection.h
parentf348964c266c6b2db80af8b7a75a6f9ef566f1c3 (diff)
greybus: begin abstracting connection operations
This is part 1 of abstracting the connection operations into a set of methods. This will avoid some big switch statements, but more importantly this will be needed for supporting multiple versions of each protocol. For now only two methods are defined. The init method is used to set up the device (or whatever the CPort represents) and the exit method tears it down. There may need to be additional operations added in the future, and once versioning is used we might stash the version number in this structure as well. The next patch adds dynamic registratration of these protocol handlers, and will do away with the switch statement now found in gb_connection_init(). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/connection.h')
-rw-r--r--drivers/staging/greybus/connection.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.h b/drivers/staging/greybus/connection.h
index 19dd91dae062..4492d2f67ec4 100644
--- a/drivers/staging/greybus/connection.h
+++ b/drivers/staging/greybus/connection.h
@@ -21,6 +21,15 @@ enum gb_connection_state {
GB_CONNECTION_STATE_DESTROYING = 4,
};
+struct gb_connection;
+typedef int (*gb_connection_init_t)(struct gb_connection *);
+typedef void (*gb_connection_exit_t)(struct gb_connection *);
+
+struct gb_connection_handler {
+ gb_connection_init_t connection_init;
+ gb_connection_exit_t connection_exit;
+};
+
struct gb_connection {
struct greybus_host_device *hd;
struct gb_interface *interface;
@@ -38,6 +47,8 @@ struct gb_connection {
atomic_t op_cycle;
struct delayed_work timeout_work;
+ struct gb_connection_handler *handler;
+
void *private;
};
#define to_gb_connection(d) container_of(d, struct gb_connection, dev)