summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/operation.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2016-05-20 11:59:57 -0500
committerGreg Kroah-Hartman <gregkh@google.com>2016-05-20 17:12:25 -0700
commitf866e66f368ee58954d83e6e99194ffcd6dfcad5 (patch)
tree59988b489b0a89f3009f9256f47fd704ec6c62f5 /drivers/staging/greybus/operation.c
parent428888a2b672444dbab9bb5127b7f583ab58ff2f (diff)
greybus: add operation traces
Define a new gb_operation event class, and define and use trace events that record when an operation is created, finally destroyed, and when its active count changes. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r--drivers/staging/greybus/operation.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
index b7cc59d0a252..259bd920e715 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -57,6 +57,8 @@ static int gb_operation_get_active(struct gb_operation *operation)
if (operation->active++ == 0)
list_add_tail(&operation->links, &connection->operations);
+ trace_gb_operation_get_active(operation);
+
spin_unlock_irqrestore(&connection->lock, flags);
return 0;
@@ -69,6 +71,9 @@ static void gb_operation_put_active(struct gb_operation *operation)
unsigned long flags;
spin_lock_irqsave(&connection->lock, flags);
+
+ trace_gb_operation_get_active(operation);
+
if (--operation->active == 0) {
list_del(&operation->links);
if (atomic_read(&operation->waiters))
@@ -536,6 +541,8 @@ gb_operation_create_flags(struct gb_connection *connection,
size_t response_size, unsigned long flags,
gfp_t gfp)
{
+ struct gb_operation *operation;
+
if (WARN_ON_ONCE(type == GB_REQUEST_TYPE_INVALID))
return NULL;
if (WARN_ON_ONCE(type & GB_MESSAGE_TYPE_RESPONSE))
@@ -544,9 +551,14 @@ gb_operation_create_flags(struct gb_connection *connection,
if (WARN_ON_ONCE(flags & ~GB_OPERATION_FLAG_USER_MASK))
flags &= GB_OPERATION_FLAG_USER_MASK;
- return gb_operation_create_common(connection, type,
+ operation = gb_operation_create_common(connection, type,
request_size, response_size,
flags, gfp);
+ if (operation)
+ trace_gb_operation_create(operation);
+
+ return operation;
+
}
EXPORT_SYMBOL_GPL(gb_operation_create_flags);
@@ -581,6 +593,7 @@ gb_operation_create_incoming(struct gb_connection *connection, u16 id,
operation->id = id;
memcpy(operation->request->header, data, size);
+ trace_gb_operation_create_incoming(operation);
return operation;
}
@@ -603,6 +616,8 @@ static void _gb_operation_destroy(struct kref *kref)
operation = container_of(kref, struct gb_operation, kref);
+ trace_gb_operation_destroy(operation);
+
if (operation->response)
gb_operation_message_free(operation->response);
gb_operation_message_free(operation->request);