greybus: connection: add control connection flag
Add control connection flag which will be set for control connections. Also add a helper function to test if the flag is set. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Родитель
d9fa3494b7
Коммит
aca7aab39a
|
@ -227,7 +227,8 @@ gb_connection_create_static(struct gb_host_device *hd, u16 hd_cport_id,
|
||||||
struct gb_connection *
|
struct gb_connection *
|
||||||
gb_connection_create_control(struct gb_interface *intf)
|
gb_connection_create_control(struct gb_interface *intf)
|
||||||
{
|
{
|
||||||
return _gb_connection_create(intf->hd, -1, intf, NULL, 0, NULL, 0);
|
return _gb_connection_create(intf->hd, -1, intf, NULL, 0, NULL,
|
||||||
|
GB_CONNECTION_FLAG_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gb_connection *
|
struct gb_connection *
|
||||||
|
@ -412,11 +413,11 @@ static int gb_connection_control_connected(struct gb_connection *connection)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
control = connection->intf->control;
|
if (gb_connection_is_control(connection))
|
||||||
|
|
||||||
if (connection == control->connection)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
control = connection->intf->control;
|
||||||
|
|
||||||
ret = gb_control_connected_operation(control, cport_id);
|
ret = gb_control_connected_operation(control, cport_id);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&connection->bundle->dev,
|
dev_err(&connection->bundle->dev,
|
||||||
|
@ -438,11 +439,11 @@ gb_connection_control_disconnected(struct gb_connection *connection)
|
||||||
if (gb_connection_is_static(connection))
|
if (gb_connection_is_static(connection))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
control = connection->intf->control;
|
if (gb_connection_is_control(connection))
|
||||||
|
|
||||||
if (connection == control->connection)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
control = connection->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->bundle->dev,
|
dev_warn(&connection->bundle->dev,
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#define GB_CONNECTION_FLAG_NO_FLOWCTRL BIT(1)
|
#define GB_CONNECTION_FLAG_NO_FLOWCTRL BIT(1)
|
||||||
#define GB_CONNECTION_FLAG_OFFLOADED BIT(2)
|
#define GB_CONNECTION_FLAG_OFFLOADED BIT(2)
|
||||||
#define GB_CONNECTION_FLAG_CDSI1 BIT(3)
|
#define GB_CONNECTION_FLAG_CDSI1 BIT(3)
|
||||||
|
#define GB_CONNECTION_FLAG_CONTROL BIT(4)
|
||||||
|
|
||||||
enum gb_connection_state {
|
enum gb_connection_state {
|
||||||
GB_CONNECTION_STATE_INVALID = 0,
|
GB_CONNECTION_STATE_INVALID = 0,
|
||||||
|
@ -104,6 +105,11 @@ static inline bool gb_connection_is_offloaded(struct gb_connection *connection)
|
||||||
return connection->flags & GB_CONNECTION_FLAG_OFFLOADED;
|
return connection->flags & GB_CONNECTION_FLAG_OFFLOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool gb_connection_is_control(struct gb_connection *connection)
|
||||||
|
{
|
||||||
|
return connection->flags & GB_CONNECTION_FLAG_CONTROL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void *gb_connection_get_data(struct gb_connection *connection)
|
static inline void *gb_connection_get_data(struct gb_connection *connection)
|
||||||
{
|
{
|
||||||
return connection->private;
|
return connection->private;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче