Commit ad1c449e authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: record connection protocol

Record the protocol association with a connection when it gets
created.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent cd345074
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* pointer otherwise. * pointer otherwise.
*/ */
struct gb_connection *gb_connection_create(struct gb_interface *interface, 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 gb_connection *connection;
struct greybus_host_device *hd; struct greybus_host_device *hd;
...@@ -41,6 +41,8 @@ struct gb_connection *gb_connection_create(struct gb_interface *interface, ...@@ -41,6 +41,8 @@ struct gb_connection *gb_connection_create(struct gb_interface *interface,
connection->hd = hd; /* XXX refcount? */ connection->hd = hd; /* XXX refcount? */
connection->interface = interface; /* XXX refcount? */ connection->interface = interface; /* XXX refcount? */
connection->interface_cport_id = cport_id; connection->interface_cport_id = cport_id;
connection->protocol = protocol;
INIT_LIST_HEAD(&connection->operations); INIT_LIST_HEAD(&connection->operations);
atomic_set(&connection->op_cycle, 0); atomic_set(&connection->op_cycle, 0);
......
...@@ -21,14 +21,14 @@ struct gb_connection { ...@@ -21,14 +21,14 @@ struct gb_connection {
struct list_head hd_links; struct list_head hd_links;
struct list_head interface_links; struct list_head interface_links;
/* protocol */ enum greybus_protocol protocol;
struct list_head operations; struct list_head operations;
atomic_t op_cycle; atomic_t op_cycle;
}; };
struct gb_connection *gb_connection_create(struct gb_interface *interface, 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); void gb_connection_destroy(struct gb_connection *connection);
u16 gb_connection_op_id(struct gb_connection *connection); u16 gb_connection_op_id(struct gb_connection *connection);
......
...@@ -204,7 +204,7 @@ u32 gb_manifest_parse_cports(struct gb_interface *interface) ...@@ -204,7 +204,7 @@ u32 gb_manifest_parse_cports(struct gb_interface *interface)
/* Found one. Set up its function structure */ /* Found one. Set up its function structure */
protocol = (enum greybus_protocol)desc_cport->protocol; protocol = (enum greybus_protocol)desc_cport->protocol;
cport_id = le16_to_cpu(desc_cport->id); 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 */ return 0; /* Error */
count++; count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment