forked from Minki/linux
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>
This commit is contained in:
parent
1f79046bd7
commit
5451ea0e99
@ -156,6 +156,59 @@ DEFINE_OPERATION_EVENT(gb_operation_put_active);
|
||||
|
||||
#undef DEFINE_OPERATION_EVENT
|
||||
|
||||
DECLARE_EVENT_CLASS(gb_module,
|
||||
|
||||
TP_PROTO(struct gb_module *module),
|
||||
|
||||
TP_ARGS(module),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(int, hd_bus_id)
|
||||
__field(u8, module_id)
|
||||
__field(u8, num_interfaces)
|
||||
__field(bool, disconnected)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->hd_bus_id = module->hd->bus_id;
|
||||
__entry->module_id = module->module_id;
|
||||
__entry->disconnected = module->disconnected;
|
||||
),
|
||||
|
||||
TP_printk("greybus: hd_bus_id=%d module_id=%hhu disconnected=%u",
|
||||
__entry->hd_bus_id, __entry->module_id, __entry->disconnected)
|
||||
);
|
||||
|
||||
#define DEFINE_MODULE_EVENT(name) \
|
||||
DEFINE_EVENT(gb_module, name, \
|
||||
TP_PROTO(struct gb_module *module), \
|
||||
TP_ARGS(module))
|
||||
|
||||
/*
|
||||
* Occurs after a new module is successfully created, before
|
||||
* creating any of its interfaces.
|
||||
*/
|
||||
DEFINE_MODULE_EVENT(gb_module_create);
|
||||
|
||||
/*
|
||||
* Occurs after the last reference to a module has been dropped.
|
||||
*/
|
||||
DEFINE_MODULE_EVENT(gb_module_release);
|
||||
|
||||
/*
|
||||
* Occurs after a module is successfully created, before registering
|
||||
* any of its interfaces.
|
||||
*/
|
||||
DEFINE_MODULE_EVENT(gb_module_add);
|
||||
|
||||
/*
|
||||
* Occurs when a module is deleted, before deregistering its
|
||||
* interfaces.
|
||||
*/
|
||||
DEFINE_MODULE_EVENT(gb_module_del);
|
||||
|
||||
#undef DEFINE_MODULE_EVENT
|
||||
|
||||
DECLARE_EVENT_CLASS(gb_host_device,
|
||||
|
||||
TP_PROTO(struct gb_host_device *hd),
|
||||
|
@ -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 @@ static void gb_module_release(struct device *dev)
|
||||
{
|
||||
struct gb_module *module = to_gb_module(dev);
|
||||
|
||||
trace_gb_module_release(module);
|
||||
|
||||
kfree(module);
|
||||
}
|
||||
|
||||
@ -109,6 +112,8 @@ struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
|
||||
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 @@ int gb_module_add(struct gb_module *module)
|
||||
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 @@ void gb_module_del(struct gb_module *module)
|
||||
for (i = 0; i < module->num_interfaces; ++i)
|
||||
gb_module_deregister_interface(module->interfaces[i]);
|
||||
|
||||
trace_gb_module_del(module);
|
||||
|
||||
device_del(&module->dev);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user