From: Alex Elder Date: Fri, 3 Jun 2016 20:55:36 +0000 (-0500) Subject: greybus: tracing: define bundle traces X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~285 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4f9c5c0bbb9fb4715ca01cd28ba04a3117a9be6f;p=karo-tx-linux.git 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 Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index e7c00b679636..c1c3d67a0279 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -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); diff --git a/drivers/staging/greybus/greybus_trace.h b/drivers/staging/greybus/greybus_trace.h index 80c428d9d1b1..a1dc07038f54 100644 --- a/drivers/staging/greybus/greybus_trace.h +++ b/drivers/staging/greybus/greybus_trace.h @@ -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),