Commit 63cf52f7 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: connection: remove legacy protocol id from core

Remove legacy protocol-id field that is only used by the legacy-protocol
driver from the connection structure.
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 8278fae5
...@@ -38,7 +38,6 @@ struct gb_connection { ...@@ -38,7 +38,6 @@ struct gb_connection {
gb_request_handler_t handler; gb_request_handler_t handler;
struct gb_protocol *protocol; struct gb_protocol *protocol;
u8 protocol_id;
u8 module_major; u8 module_major;
u8 module_minor; u8 module_minor;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
struct legacy_connection { struct legacy_connection {
struct gb_connection *connection; struct gb_connection *connection;
bool initialized; bool initialized;
u8 protocol_id;
}; };
struct legacy_data { struct legacy_data {
...@@ -38,8 +39,9 @@ static int legacy_connection_get_version(struct gb_connection *connection) ...@@ -38,8 +39,9 @@ static int legacy_connection_get_version(struct gb_connection *connection)
return 0; return 0;
} }
static int legacy_connection_bind_protocol(struct gb_connection *connection) static int legacy_connection_bind_protocol(struct legacy_connection *lc)
{ {
struct gb_connection *connection = lc->connection;
struct gb_protocol *protocol; struct gb_protocol *protocol;
u8 major, minor; u8 major, minor;
...@@ -52,14 +54,11 @@ static int legacy_connection_bind_protocol(struct gb_connection *connection) ...@@ -52,14 +54,11 @@ static int legacy_connection_bind_protocol(struct gb_connection *connection)
major = 0; major = 0;
minor = 1; minor = 1;
protocol = gb_protocol_get(connection->protocol_id, protocol = gb_protocol_get(lc->protocol_id, major, minor);
major,
minor);
if (!protocol) { if (!protocol) {
dev_err(&connection->hd->dev, dev_err(&connection->hd->dev,
"protocol 0x%02x version %u.%u not found\n", "protocol 0x%02x version %u.%u not found\n",
connection->protocol_id, lc->protocol_id, major, minor);
major, minor);
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
} }
connection->protocol = protocol; connection->protocol = protocol;
...@@ -92,7 +91,7 @@ static int legacy_connection_init(struct legacy_connection *lc) ...@@ -92,7 +91,7 @@ static int legacy_connection_init(struct legacy_connection *lc)
dev_dbg(&connection->bundle->dev, "%s - %s\n", __func__, dev_dbg(&connection->bundle->dev, "%s - %s\n", __func__,
connection->name); connection->name);
ret = legacy_connection_bind_protocol(lc->connection); ret = legacy_connection_bind_protocol(lc);
if (ret) if (ret)
return ret; return ret;
...@@ -152,7 +151,7 @@ static int legacy_connection_create(struct legacy_connection *lc, ...@@ -152,7 +151,7 @@ static int legacy_connection_create(struct legacy_connection *lc,
return PTR_ERR(connection); return PTR_ERR(connection);
lc->connection = connection; lc->connection = connection;
lc->connection->protocol_id = desc->protocol_id; lc->protocol_id = desc->protocol_id;
return 0; return 0;
} }
......
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