greybus: register preallocated protocols
Set up protocol structures as static objects in each protocol source
file. Pass the address of that in--rather than the protocol id and
version information--to the protocol registration routine. Call a
central routine to register all our pre-defined protocols.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/staging/greybus/uart-gb.c b/drivers/staging/greybus/uart-gb.c
index b52d9e1..5596644 100644
--- a/drivers/staging/greybus/uart-gb.c
+++ b/drivers/staging/greybus/uart-gb.c
@@ -524,3 +524,19 @@
.connection_init = gb_uart_connection_init,
.connection_exit = gb_uart_connection_exit,
};
+
+static struct gb_protocol uart_protocol = {
+ .id = GREYBUS_PROTOCOL_UART,
+ .major = 0,
+ .minor = 1,
+};
+
+bool gb_uart_protocol_init(void)
+{
+ return gb_protocol_register(&uart_protocol);
+}
+
+void gb_uart_protocol_exit(void)
+{
+ gb_protocol_deregister(&uart_protocol);
+}