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/battery-gb.c b/drivers/staging/greybus/battery-gb.c
index 28c0d0b..457daf70 100644
--- a/drivers/staging/greybus/battery-gb.c
+++ b/drivers/staging/greybus/battery-gb.c
@@ -404,3 +404,19 @@
 	.connection_init	= gb_battery_connection_init,
 	.connection_exit	= gb_battery_connection_exit,
 };
+
+static struct gb_protocol battery_protocol = {
+	.id			= GREYBUS_PROTOCOL_BATTERY,
+	.major			= 0,
+	.minor			= 1,
+};
+
+bool gb_battery_protocol_init(void)
+{
+	return gb_protocol_register(&battery_protocol);
+}
+
+void gb_battery_protocol_exit(void)
+{
+	gb_protocol_deregister(&battery_protocol);
+}