From ad1c449eb905ac1bf819afe9b799c11a6cf304a6 Mon Sep 17 00:00:00 2001
From: Alex Elder <elder@linaro.org>
Date: Thu, 2 Oct 2014 12:30:06 -0500
Subject: [PATCH] greybus: record connection protocol

Record the protocol association with a connection when it gets
created.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
---
 drivers/staging/greybus/connection.c | 4 +++-
 drivers/staging/greybus/connection.h | 4 ++--
 drivers/staging/greybus/manifest.c   | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index f3f774d2ed7b8..d63048c4f7de4 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -23,7 +23,7 @@
  * pointer otherwise.
  */
 struct gb_connection *gb_connection_create(struct gb_interface *interface,
-						u16 cport_id)
+				u16 cport_id, enum greybus_protocol protocol)
 {
 	struct gb_connection *connection;
 	struct greybus_host_device *hd;
@@ -41,6 +41,8 @@ struct gb_connection *gb_connection_create(struct gb_interface *interface,
 	connection->hd = hd;			/* XXX refcount? */
 	connection->interface = interface;	/* XXX refcount? */
 	connection->interface_cport_id = cport_id;
+	connection->protocol = protocol;
+
 	INIT_LIST_HEAD(&connection->operations);
 	atomic_set(&connection->op_cycle, 0);
 
diff --git a/drivers/staging/greybus/connection.h b/drivers/staging/greybus/connection.h
index 530d6451c75d9..15bdc815286d4 100644
--- a/drivers/staging/greybus/connection.h
+++ b/drivers/staging/greybus/connection.h
@@ -21,14 +21,14 @@ struct gb_connection {
 
 	struct list_head		hd_links;
 	struct list_head		interface_links;
-	/* protocol */
+	enum greybus_protocol		protocol;
 
 	struct list_head		operations;
 	atomic_t			op_cycle;
 };
 
 struct gb_connection *gb_connection_create(struct gb_interface *interface,
-						u16 cport_id);
+				u16 cport_id, enum greybus_protocol protocol);
 void gb_connection_destroy(struct gb_connection *connection);
 
 u16 gb_connection_op_id(struct gb_connection *connection);
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 6411c26928b33..a694c886b9ea2 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -204,7 +204,7 @@ u32 gb_manifest_parse_cports(struct gb_interface *interface)
 		/* Found one.  Set up its function structure */
 		protocol = (enum greybus_protocol)desc_cport->protocol;
 		cport_id = le16_to_cpu(desc_cport->id);
-		if (!gb_connection_create(interface, cport_id))
+		if (!gb_connection_create(interface, cport_id, protocol))
 			return 0;	/* Error */
 
 		count++;
-- 
2.30.2