Lines Matching full:connection
37 * Increment operation active count and add to connection list unless the
38 * connection is going away.
44 struct gb_connection *connection = operation->connection; in gb_operation_get_active() local
47 spin_lock_irqsave(&connection->lock, flags); in gb_operation_get_active()
48 switch (connection->state) { in gb_operation_get_active()
64 list_add_tail(&operation->links, &connection->operations); in gb_operation_get_active()
68 spin_unlock_irqrestore(&connection->lock, flags); in gb_operation_get_active()
73 spin_unlock_irqrestore(&connection->lock, flags); in gb_operation_get_active()
81 struct gb_connection *connection = operation->connection; in gb_operation_put_active() local
84 spin_lock_irqsave(&connection->lock, flags); in gb_operation_put_active()
93 spin_unlock_irqrestore(&connection->lock, flags); in gb_operation_put_active()
98 struct gb_connection *connection = operation->connection; in gb_operation_is_active() local
102 spin_lock_irqsave(&connection->lock, flags); in gb_operation_is_active()
104 spin_unlock_irqrestore(&connection->lock, flags); in gb_operation_is_active()
192 * Looks up an outgoing operation on a connection and returns a refcounted
196 gb_operation_find_outgoing(struct gb_connection *connection, u16 operation_id) in gb_operation_find_outgoing() argument
202 spin_lock_irqsave(&connection->lock, flags); in gb_operation_find_outgoing()
203 list_for_each_entry(operation, &connection->operations, links) in gb_operation_find_outgoing()
210 spin_unlock_irqrestore(&connection->lock, flags); in gb_operation_find_outgoing()
217 struct gb_connection *connection = message->operation->connection; in gb_message_send() local
220 return connection->hd->driver->message_send(connection->hd, in gb_message_send()
221 connection->hd_cport_id, in gb_message_send()
231 struct gb_host_device *hd = message->operation->connection->hd; in gb_message_cancel()
238 struct gb_connection *connection = operation->connection; in gb_operation_request_handle() local
242 if (connection->handler) { in gb_operation_request_handle()
243 status = connection->handler(operation); in gb_operation_request_handle()
245 dev_err(&connection->hd->dev, in gb_operation_request_handle()
247 connection->name, operation->type); in gb_operation_request_handle()
254 dev_err(&connection->hd->dev, in gb_operation_request_handle()
256 connection->name, status, operation->type, ret); in gb_operation_request_handle()
472 struct gb_host_device *hd = operation->connection->hd; in gb_operation_response_alloc()
498 * Create a Greybus operation to be sent over the given connection.
520 gb_operation_create_common(struct gb_connection *connection, u8 type, in gb_operation_create_common() argument
524 struct gb_host_device *hd = connection->hd; in gb_operation_create_common()
530 operation->connection = connection; in gb_operation_create_common()
568 * Create a new operation associated with the given connection. The
576 gb_operation_create_flags(struct gb_connection *connection, in gb_operation_create_flags() argument
591 operation = gb_operation_create_common(connection, type, in gb_operation_create_flags()
602 gb_operation_create_core(struct gb_connection *connection, in gb_operation_create_core() argument
611 operation = gb_operation_create_common(connection, type, in gb_operation_create_core()
622 size_t gb_operation_get_payload_size_max(struct gb_connection *connection) in gb_operation_get_payload_size_max() argument
624 struct gb_host_device *hd = connection->hd; in gb_operation_get_payload_size_max()
631 gb_operation_create_incoming(struct gb_connection *connection, u16 id, in gb_operation_create_incoming() argument
644 operation = gb_operation_create_common(connection, type, in gb_operation_create_incoming()
726 struct gb_connection *connection = operation->connection; in gb_operation_request_send() local
731 if (gb_connection_is_offloaded(connection)) in gb_operation_request_send()
751 cycle = (unsigned int)atomic_inc_return(&connection->op_cycle); in gb_operation_request_send()
827 struct gb_connection *connection = operation->connection; in gb_operation_response_send() local
838 dev_err(&connection->hd->dev, "request result already set\n"); in gb_operation_response_send()
876 struct gb_connection *connection = operation->connection; in greybus_message_sent() local
891 dev_err(&connection->hd->dev, in greybus_message_sent()
893 connection->name, operation->type, status); in greybus_message_sent()
908 * We've received data on a connection, and it doesn't look like a
914 static void gb_connection_recv_request(struct gb_connection *connection, in gb_connection_recv_request() argument
926 operation = gb_operation_create_incoming(connection, operation_id, in gb_connection_recv_request()
929 dev_err(&connection->hd->dev, in gb_connection_recv_request()
931 connection->name); in gb_connection_recv_request()
947 queue_work(connection->wq, &operation->work); in gb_connection_recv_request()
958 static void gb_connection_recv_response(struct gb_connection *connection, in gb_connection_recv_response() argument
971 dev_err_ratelimited(&connection->hd->dev, in gb_connection_recv_response()
973 connection->name); in gb_connection_recv_response()
977 operation = gb_operation_find_outgoing(connection, operation_id); in gb_connection_recv_response()
979 dev_err_ratelimited(&connection->hd->dev, in gb_connection_recv_response()
981 connection->name, operation_id); in gb_connection_recv_response()
989 dev_err_ratelimited(&connection->hd->dev, in gb_connection_recv_response()
991 connection->name, header->type, in gb_connection_recv_response()
998 dev_err_ratelimited(&connection->hd->dev, in gb_connection_recv_response()
1000 connection->name, header->type, in gb_connection_recv_response()
1023 * Handle data arriving on a connection. As soon as we return the
1027 void gb_connection_recv(struct gb_connection *connection, in gb_connection_recv() argument
1031 struct device *dev = &connection->hd->dev; in gb_connection_recv()
1034 if (connection->state == GB_CONNECTION_STATE_DISABLED || in gb_connection_recv()
1035 gb_connection_is_offloaded(connection)) { in gb_connection_recv()
1037 connection->name, size); in gb_connection_recv()
1043 connection->name); in gb_connection_recv()
1053 connection->name, in gb_connection_recv()
1060 gb_connection_recv_response(connection, &header, data, in gb_connection_recv()
1063 gb_connection_recv_request(connection, &header, data, in gb_connection_recv()
1091 * Cancel an incoming operation synchronously. Called during connection tear
1118 * @connection: the Greybus connection to send this to
1139 int gb_operation_sync_timeout(struct gb_connection *connection, int type, in gb_operation_sync_timeout() argument
1151 operation = gb_operation_create(connection, type, in gb_operation_sync_timeout()
1162 dev_err(&connection->hd->dev, in gb_operation_sync_timeout()
1164 connection->name, operation->id, type, ret); in gb_operation_sync_timeout()
1180 * @connection: connection to use
1190 * the request as actually reached the remote end of the connection.
1192 int gb_operation_unidirectional_timeout(struct gb_connection *connection, in gb_operation_unidirectional_timeout() argument
1203 operation = gb_operation_create_flags(connection, type, in gb_operation_unidirectional_timeout()
1215 dev_err(&connection->hd->dev, in gb_operation_unidirectional_timeout()
1217 connection->name, type, ret); in gb_operation_unidirectional_timeout()