greybus: tracing: add module traces
Define a new gb_module trace point event class, used to trace events
associated with the module abstraction. Define four basic trace
points for this--creation time, drop of last reference, before
registring interfaces and after de-registering them.
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c
index ea58954..c56b988 100644
--- a/drivers/staging/greybus/module.c
+++ b/drivers/staging/greybus/module.c
@@ -9,6 +9,7 @@
#include "greybus.h"
+#include "greybus_trace.h"
static ssize_t eject_store(struct device *dev,
struct device_attribute *attr,
@@ -77,6 +78,8 @@
{
struct gb_module *module = to_gb_module(dev);
+ trace_gb_module_release(module);
+
kfree(module);
}
@@ -109,6 +112,8 @@
device_initialize(&module->dev);
dev_set_name(&module->dev, "%d-%u", hd->bus_id, module_id);
+ trace_gb_module_create(module);
+
for (i = 0; i < num_interfaces; ++i) {
intf = gb_interface_create(module, module_id + i);
if (!intf) {
@@ -215,6 +220,8 @@
return ret;
}
+ trace_gb_module_add(module);
+
for (i = 0; i < module->num_interfaces; ++i)
gb_module_register_interface(module->interfaces[i]);
@@ -229,6 +236,8 @@
for (i = 0; i < module->num_interfaces; ++i)
gb_module_deregister_interface(module->interfaces[i]);
+ trace_gb_module_del(module);
+
device_del(&module->dev);
}