Commit 7422a1ec authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

greybus: protocol: name protocols.



We want to be able to "blame" a protocol for things at times, so give
them a name we can refer to them by.  Announce when they are added or
removed from the system so we have a chance to know what is going on
in the kernel logs.

Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent e5646710
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -359,6 +359,7 @@ static void gb_battery_connection_exit(struct gb_connection *connection)
}

static struct gb_protocol battery_protocol = {
	.name			= "battery",
	.id			= GREYBUS_PROTOCOL_BATTERY,
	.major			= 0,
	.minor			= 1,
+1 −0
Original line number Diff line number Diff line
@@ -524,6 +524,7 @@ static void gb_gpio_connection_exit(struct gb_connection *connection)
}

static struct gb_protocol gpio_protocol = {
	.name			= "gpio",
	.id			= GREYBUS_PROTOCOL_GPIO,
	.major			= 0,
	.minor			= 1,
+1 −0
Original line number Diff line number Diff line
@@ -430,6 +430,7 @@ static void gb_i2c_connection_exit(struct gb_connection *connection)
}

static struct gb_protocol i2c_protocol = {
	.name			= "i2c",
	.id			= GREYBUS_PROTOCOL_I2C,
	.major			= 0,
	.minor			= 1,
+7 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
 * Released under the GPLv2 only.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include "greybus.h"

/* Global list of registered protocols */
@@ -86,6 +88,8 @@ int __gb_protocol_register(struct gb_protocol *protocol, struct module *module)
	list_add_tail(&protocol->links, &existing->links);
	spin_unlock_irq(&gb_protocols_lock);

	pr_info("Registered %s protocol.\n", protocol->name);

	/*
	 * Go try to bind any unbound connections, as we have a
	 * new protocol in the system
@@ -124,6 +128,9 @@ int gb_protocol_deregister(struct gb_protocol *protocol)
	}
	spin_unlock_irq(&gb_protocols_lock);

	if (protocol)
		pr_info("Deregistered %s protocol.\n", protocol->name);

	return protocol && !protocol_count;
}
EXPORT_SYMBOL_GPL(gb_protocol_deregister);
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ struct gb_protocol {
	gb_connection_exit_t	connection_exit;
	gb_request_recv_t	request_recv;
	struct module		*owner;
	char			*name;
};

int __gb_protocol_register(struct gb_protocol *protocol, struct module *module);
Loading