]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: operation: add helper to retrieve max payload size
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 19 May 2015 09:22:46 +0000 (11:22 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 21 May 2015 05:52:03 +0000 (22:52 -0700)
Add helper to retrieve the maximum payload size for operations on a
specific connection.

Note that the helper is not inlined due to how the header files are
currently organised, but it is not expected to be called after a
connection has been initialised either.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.h

index c78ccc09d6674c6f801ba41127150e9610c5c951..f595b97fa90001e88287f733d7d30021e1789e78 100644 (file)
@@ -504,6 +504,14 @@ struct gb_operation *gb_operation_create(struct gb_connection *connection,
 }
 EXPORT_SYMBOL_GPL(gb_operation_create);
 
+size_t gb_operation_get_payload_size_max(struct gb_connection *connection)
+{
+       struct greybus_host_device *hd = connection->hd;
+
+       return hd->buffer_size_max - sizeof(struct gb_operation_msg_hdr);
+}
+EXPORT_SYMBOL_GPL(gb_operation_get_payload_size_max);
+
 static struct gb_operation *
 gb_operation_create_incoming(struct gb_connection *connection, u16 id,
                                u8 type, void *data, size_t size)
index 740aacc3a3db4151b94998bf0c9ae11e53b4e4c3..0199976c9b5fd1388fe88a98ba1e58d4172b1dee 100644 (file)
@@ -130,6 +130,7 @@ void gb_connection_recv(struct gb_connection *connection,
 
 int gb_operation_result(struct gb_operation *operation);
 
+size_t gb_operation_get_payload_size_max(struct gb_connection *connection);
 struct gb_operation *gb_operation_create(struct gb_connection *connection,
                                        u8 type, size_t request_size,
                                        size_t response_size);