greybus: tracing: define bundle traces
Define a new gb_bundle trace point event class, used to trace events associated with the bundle abstraction. Define four basic trace points for this--creation time, drop of last reference, before adding it to its interface and when removed when its interface is destroyed. Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
6879dbf15e
commit
4f9c5c0bbb
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "greybus.h"
|
||||
#include "greybus_trace.h"
|
||||
|
||||
static ssize_t bundle_class_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
@ -82,6 +83,8 @@ static void gb_bundle_release(struct device *dev)
|
||||
{
|
||||
struct gb_bundle *bundle = to_gb_bundle(dev);
|
||||
|
||||
trace_gb_bundle_release(bundle);
|
||||
|
||||
kfree(bundle->state);
|
||||
kfree(bundle->cport_desc);
|
||||
kfree(bundle);
|
||||
@ -136,6 +139,8 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
|
||||
|
||||
list_add(&bundle->links, &intf->bundles);
|
||||
|
||||
trace_gb_bundle_create(bundle);
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@ -149,6 +154,8 @@ int gb_bundle_add(struct gb_bundle *bundle)
|
||||
return ret;
|
||||
}
|
||||
|
||||
trace_gb_bundle_add(bundle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -157,6 +164,8 @@ int gb_bundle_add(struct gb_bundle *bundle)
|
||||
*/
|
||||
void gb_bundle_destroy(struct gb_bundle *bundle)
|
||||
{
|
||||
trace_gb_bundle_destroy(bundle);
|
||||
|
||||
if (device_is_registered(&bundle->dev))
|
||||
device_del(&bundle->dev);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
struct gb_message;
|
||||
struct gb_operation;
|
||||
struct gb_bundle;
|
||||
struct gb_host_device;
|
||||
|
||||
#define gb_bundle_name(message) \
|
||||
@ -161,6 +162,61 @@ DEFINE_OPERATION_EVENT(gb_operation_put_active);
|
||||
|
||||
#undef DEFINE_OPERATION_EVENT
|
||||
|
||||
DECLARE_EVENT_CLASS(gb_bundle,
|
||||
|
||||
TP_PROTO(struct gb_bundle *bundle),
|
||||
|
||||
TP_ARGS(bundle),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(u8, intf_id)
|
||||
__field(u8, id)
|
||||
__field(u8, class)
|
||||
__field(size_t, num_cports)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->intf_id = bundle->intf->interface_id;
|
||||
__entry->id = bundle->id;
|
||||
__entry->class = bundle->class;
|
||||
__entry->num_cports = bundle->num_cports;
|
||||
),
|
||||
|
||||
TP_printk("intf_id=0x%02x id=%02x class=0x%02x num_cports=%zu",
|
||||
__entry->intf_id, __entry->id, __entry->class,
|
||||
__entry->num_cports)
|
||||
);
|
||||
|
||||
#define DEFINE_BUNDLE_EVENT(name) \
|
||||
DEFINE_EVENT(gb_bundle, name, \
|
||||
TP_PROTO(struct gb_bundle *bundle), \
|
||||
TP_ARGS(bundle))
|
||||
|
||||
/*
|
||||
* Occurs after a new bundle is successfully created.
|
||||
*/
|
||||
DEFINE_BUNDLE_EVENT(gb_bundle_create);
|
||||
|
||||
/*
|
||||
* Occurs when the last reference to a bundle has been dropped,
|
||||
* before its resources are freed.
|
||||
*/
|
||||
DEFINE_BUNDLE_EVENT(gb_bundle_release);
|
||||
|
||||
/*
|
||||
* Occurs when a bundle is added to an interface when the interface
|
||||
* is enabled.
|
||||
*/
|
||||
DEFINE_BUNDLE_EVENT(gb_bundle_add);
|
||||
|
||||
/*
|
||||
* Occurs when a registered bundle gets destroyed, normally at the
|
||||
* time an interface is disabled.
|
||||
*/
|
||||
DEFINE_BUNDLE_EVENT(gb_bundle_destroy);
|
||||
|
||||
#undef DEFINE_BUNDLE_EVENT
|
||||
|
||||
DECLARE_EVENT_CLASS(gb_interface,
|
||||
|
||||
TP_PROTO(struct gb_interface *intf),
|
||||
|
Loading…
Reference in New Issue
Block a user