aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2016-06-03 15:55:37 -0500
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-03 17:03:23 -0700
commit79c8c6494220dafeaedf8dc94b50c9a787e25e5d (patch)
treea37089c6258bf45eb2a59e61c62b7ad2b5ace47e /drivers/staging/greybus/connection.c
parentgreybus: tracing: define bundle traces (diff)
downloadlinux-dev-79c8c6494220dafeaedf8dc94b50c9a787e25e5d.tar.xz
linux-dev-79c8c6494220dafeaedf8dc94b50c9a787e25e5d.zip
greybus: tracing: define connection traces
Define a new gb_connection trace point event class, used to trace events associated with the connection abstraction. Define four basic trace events for this--creation, drop of last reference, and when adding or dropping any other reference. There are certainly more events that we might want to add, but aim is to just get the basic framework in place. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r--drivers/staging/greybus/connection.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c
index 3be767b9a0de..d35e95a17c56 100644
--- a/drivers/staging/greybus/connection.c
+++ b/drivers/staging/greybus/connection.c
@@ -10,6 +10,7 @@
#include <linux/workqueue.h>
#include "greybus.h"
+#include "greybus_trace.h"
static void gb_connection_kref_release(struct kref *kref);
@@ -38,10 +39,14 @@ gb_connection_intf_find(struct gb_interface *intf, u16 cport_id)
static void gb_connection_get(struct gb_connection *connection)
{
kref_get(&connection->kref);
+
+ trace_gb_connection_get(connection);
}
static void gb_connection_put(struct gb_connection *connection)
{
+ trace_gb_connection_put(connection);
+
kref_put(&connection->kref, gb_connection_kref_release);
}
@@ -93,6 +98,8 @@ static void gb_connection_kref_release(struct kref *kref)
connection = container_of(kref, struct gb_connection, kref);
+ trace_gb_connection_release(connection);
+
kfree(connection);
}
@@ -204,6 +211,8 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id,
mutex_unlock(&gb_connection_mutex);
+ trace_gb_connection_create(connection);
+
return connection;
err_free_connection:
@@ -709,6 +718,9 @@ int gb_connection_enable(struct gb_connection *connection)
goto out_unlock;
ret = _gb_connection_enable(connection, true);
+ if (!ret)
+ trace_gb_connection_enable(connection);
+
out_unlock:
mutex_unlock(&connection->mutex);
@@ -731,6 +743,9 @@ int gb_connection_enable_tx(struct gb_connection *connection)
goto out_unlock;
ret = _gb_connection_enable(connection, false);
+ if (!ret)
+ trace_gb_connection_enable(connection);
+
out_unlock:
mutex_unlock(&connection->mutex);
@@ -751,6 +766,8 @@ void gb_connection_disable_rx(struct gb_connection *connection)
gb_connection_flush_incoming_operations(connection, -ESHUTDOWN);
spin_unlock_irq(&connection->lock);
+ trace_gb_connection_disable(connection);
+
out_unlock:
mutex_unlock(&connection->mutex);
}
@@ -793,6 +810,8 @@ void gb_connection_disable(struct gb_connection *connection)
connection->state = GB_CONNECTION_STATE_DISABLED;
+ trace_gb_connection_disable(connection);
+
/* control-connection tear down is deferred when mode switching */
if (!connection->mode_switch) {
gb_connection_svc_connection_destroy(connection);
@@ -822,6 +841,8 @@ void gb_connection_disable_forced(struct gb_connection *connection)
gb_connection_svc_connection_destroy(connection);
gb_connection_hd_cport_disable(connection);
+ trace_gb_connection_disable(connection);
+
out_unlock:
mutex_unlock(&connection->mutex);
}