diff options
author | Alex Elder | 2014-10-16 13:35:35 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2014-10-17 18:14:11 +0200 |
commit | 574341c67213afdc9dcb5aefb4f6fa84644438bb (patch) | |
tree | 1c9069ba64526541840f793f933a4fe860750b08 /drivers/staging/greybus/connection.c | |
parent | greybus: move receive handling to operation layer (diff) | |
download | kernel-qcow2-linux-574341c67213afdc9dcb5aefb4f6fa84644438bb.tar.gz kernel-qcow2-linux-574341c67213afdc9dcb5aefb4f6fa84644438bb.tar.xz kernel-qcow2-linux-574341c67213afdc9dcb5aefb4f6fa84644438bb.zip |
greybus: add device initialization
Set up the infrastructure for initializing connections based on
their protocol.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.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 740f491bf5fc..0143a4f6bd12 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -191,3 +191,27 @@ void gb_connection_err(struct gb_connection *connection, const char *fmt, ...) va_end(args); } + +/* + * XXX Protocols should have a set of function pointers: + * ->init (called here, to initialize the device) + * ->input_handler + * ->exit (reverse of init) + */ +int gb_connection_init(struct gb_connection *connection) +{ + switch (connection->protocol) { + case GREYBUS_PROTOCOL_I2C: + case GREYBUS_PROTOCOL_CONTROL: + case GREYBUS_PROTOCOL_AP: + case GREYBUS_PROTOCOL_GPIO: + case GREYBUS_PROTOCOL_UART: + case GREYBUS_PROTOCOL_HID: + case GREYBUS_PROTOCOL_VENDOR: + default: + gb_connection_err(connection, "unimplemented protocol %u", + (u32)connection->protocol); + break; + } + return -ENXIO; +} |