Commit 72d74822 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: connection: clean up control-disconnected helper

Rename helper to the more descriptive
gb_connection_control_disconnected().

Use u16 for cport number, remove redundant cport number from warning
message, and shorten a long line.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 8d7a712c
...@@ -368,22 +368,25 @@ gb_connection_svc_connection_destroy(struct gb_connection *connection) ...@@ -368,22 +368,25 @@ gb_connection_svc_connection_destroy(struct gb_connection *connection)
connection->intf_cport_id); connection->intf_cport_id);
} }
static void gb_connection_disconnected(struct gb_connection *connection) /* Inform Interface about inactive CPorts */
static void
gb_connection_control_disconnected(struct gb_connection *connection)
{ {
struct gb_protocol *protocol = connection->protocol;
struct gb_control *control; struct gb_control *control;
int cport_id = connection->intf_cport_id; u16 cport_id = connection->intf_cport_id;
int ret; int ret;
/* Inform Interface about inactive CPorts */ if (protocol->flags & GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED)
if (connection->protocol->flags & GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED)
return; return;
control = connection->bundle->intf->control; control = connection->bundle->intf->control;
ret = gb_control_disconnected_operation(control, cport_id); ret = gb_control_disconnected_operation(control, cport_id);
if (ret) if (ret) {
dev_warn(&connection->dev, dev_warn(&connection->dev,
"Failed to disconnect CPort-%d (%d)\n", cport_id, ret); "failed to disconnect cport: %d\n", ret);
}
} }
static int gb_connection_init(struct gb_connection *connection) static int gb_connection_init(struct gb_connection *connection)
...@@ -439,7 +442,7 @@ static int gb_connection_init(struct gb_connection *connection) ...@@ -439,7 +442,7 @@ static int gb_connection_init(struct gb_connection *connection)
connection->state = GB_CONNECTION_STATE_ERROR; connection->state = GB_CONNECTION_STATE_ERROR;
spin_unlock_irq(&connection->lock); spin_unlock_irq(&connection->lock);
gb_connection_disconnected(connection); gb_connection_control_disconnected(connection);
err_svc_destroy: err_svc_destroy:
gb_connection_svc_connection_destroy(connection); gb_connection_svc_connection_destroy(connection);
...@@ -462,7 +465,7 @@ static void gb_connection_exit(struct gb_connection *connection) ...@@ -462,7 +465,7 @@ static void gb_connection_exit(struct gb_connection *connection)
gb_connection_cancel_operations(connection, -ESHUTDOWN); gb_connection_cancel_operations(connection, -ESHUTDOWN);
connection->protocol->connection_exit(connection); connection->protocol->connection_exit(connection);
gb_connection_disconnected(connection); gb_connection_control_disconnected(connection);
gb_connection_svc_connection_destroy(connection); gb_connection_svc_connection_destroy(connection);
} }
......
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