From c3aa6556659fe25b2fb27b86e65c6610b4066950 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Oct 2015 11:21:06 -0700 Subject: [PATCH] greybus: operation: use the bundle struct device instead of the connector We are removing struct device from the gb_connection structure in the near future. The gb_bundle structure's struct device should be used as a replacement. This patch moves the operation code to use to use the bundle pointer instead of the connection pointer when printing out error messages. Signed-off-by: Greg Kroah-Hartman Reviewed-by: Alex Elder --- drivers/staging/greybus/operation.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 56375c9e4d36..3e29d211fbcf 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -227,7 +227,7 @@ static void gb_operation_request_handle(struct gb_operation *operation) if (protocol->request_recv) { status = protocol->request_recv(operation->type, operation); } else { - dev_err(&operation->connection->dev, + dev_err(&operation->connection->bundle->dev, "unexpected incoming request type 0x%02hhx\n", operation->type); @@ -236,7 +236,7 @@ static void gb_operation_request_handle(struct gb_operation *operation) ret = gb_operation_response_send(operation, status); if (ret) { - dev_err(&operation->connection->dev, + dev_err(&operation->connection->bundle->dev, "failed to send response %d for type 0x%02hhx: %d\n", status, operation->type, ret); return; @@ -743,7 +743,7 @@ static int gb_operation_response_send(struct gb_operation *operation, /* Record the result */ if (!gb_operation_result_set(operation, errno)) { - dev_err(&connection->dev, "request result already set\n"); + dev_err(&connection->bundle->dev, "request result already set\n"); return -EIO; /* Shouldn't happen */ } @@ -795,7 +795,7 @@ void greybus_message_sent(struct greybus_host_device *hd, */ if (message == operation->response) { if (status) { - dev_err(&connection->dev, + dev_err(&connection->bundle->dev, "error sending response type 0x%02hhx: %d\n", operation->type, status); } @@ -827,7 +827,8 @@ static void gb_connection_recv_request(struct gb_connection *connection, operation = gb_operation_create_incoming(connection, operation_id, type, data, size); if (!operation) { - dev_err(&connection->dev, "can't create incoming operation\n"); + dev_err(&connection->bundle->dev, + "can't create incoming operation\n"); return; } @@ -864,15 +865,15 @@ static void gb_connection_recv_response(struct gb_connection *connection, operation = gb_operation_find_outgoing(connection, operation_id); if (!operation) { - dev_err(&connection->dev, "unexpected response 0x%04hx received\n", - operation_id); + dev_err(&connection->bundle->dev, + "unexpected response 0x%04hx received\n", operation_id); return; } message = operation->response; message_size = sizeof(*message->header) + message->payload_size; if (!errno && size != message_size) { - dev_err(&connection->dev, + dev_err(&connection->bundle->dev, "malformed response of type 0x%02hhx received (%zu != %zu)\n", message->header->type, size, message_size); errno = -EMSGSIZE; @@ -901,17 +902,17 @@ void gb_connection_recv(struct gb_connection *connection, void *data, size_t size) { struct gb_operation_msg_hdr header; + struct device *dev = &connection->bundle->dev; size_t msg_size; u16 operation_id; if (connection->state != GB_CONNECTION_STATE_ENABLED) { - dev_warn(&connection->dev, "dropping %zu received bytes\n", - size); + dev_warn(dev, "dropping %zu received bytes\n", size); return; } if (size < sizeof(header)) { - dev_err(&connection->dev, "short message received\n"); + dev_err(dev, "short message received\n"); return; } @@ -919,7 +920,7 @@ void gb_connection_recv(struct gb_connection *connection, memcpy(&header, data, sizeof(header)); msg_size = le16_to_cpu(header.size); if (size < msg_size) { - dev_err(&connection->dev, + dev_err(dev, "incomplete message 0x%04hx of type 0x%02hhx received (%zu < %zu)\n", le16_to_cpu(header.operation_id), header.type, size, msg_size); @@ -1029,7 +1030,7 @@ int gb_operation_sync_timeout(struct gb_connection *connection, int type, ret = gb_operation_request_send_sync_timeout(operation, timeout); if (ret) { - dev_err(&connection->dev, + dev_err(&connection->bundle->dev, "synchronous operation of type 0x%02hhx failed: %d\n", type, ret); } else { -- 2.20.1