mirror of https://gitee.com/openkylin/linux.git
greybus: tracing: define interface traces
Define a new gb_module trace point event class, used to trace events associated with the interface abstraction. Define four basic trace points for this--creation time, drop of last reference, before registring interfaces and after de-registering them. In addition, define traces for activating and deactivating, and enabling and disabling an interface. 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
5451ea0e99
commit
cb4c8441e5
|
@ -209,6 +209,86 @@ DEFINE_MODULE_EVENT(gb_module_del);
|
|||
|
||||
#undef DEFINE_MODULE_EVENT
|
||||
|
||||
DECLARE_EVENT_CLASS(gb_interface,
|
||||
|
||||
TP_PROTO(struct gb_interface *intf),
|
||||
|
||||
TP_ARGS(intf),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(u8, id) /* Interface id */
|
||||
__field(u8, module_id)
|
||||
__field(u8, device_id)
|
||||
__field(bool, disconnected)
|
||||
__field(bool, ejected)
|
||||
__field(bool, active)
|
||||
__field(bool, enabled)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = intf->interface_id;
|
||||
__entry->module_id = intf->module->module_id;
|
||||
__entry->device_id = intf->device_id;
|
||||
__entry->disconnected = intf->disconnected;
|
||||
__entry->ejected = intf->ejected;
|
||||
__entry->active = intf->active;
|
||||
__entry->enabled = intf->enabled;
|
||||
),
|
||||
|
||||
TP_printk("greybus: intf_id=%hhu device_id=%hhu module_id=%hhu D=%u J=%u A=%u E=%u",
|
||||
__entry->id, __entry->device_id, __entry->module_id,
|
||||
__entry->disconnected, __entry->ejected, __entry->active,
|
||||
__entry->enabled)
|
||||
);
|
||||
|
||||
#define DEFINE_INTERFACE_EVENT(name) \
|
||||
DEFINE_EVENT(gb_interface, name, \
|
||||
TP_PROTO(struct gb_interface *intf), \
|
||||
TP_ARGS(intf))
|
||||
|
||||
/*
|
||||
* Occurs after a new interface is successfully created.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_create);
|
||||
|
||||
/*
|
||||
* Occurs after the last reference to an interface has been dropped.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_release);
|
||||
|
||||
/*
|
||||
* Occurs after an interface been registerd.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_add);
|
||||
|
||||
/*
|
||||
* Occurs when a registered interface gets deregisterd.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_del);
|
||||
|
||||
/*
|
||||
* Occurs when a registered interface has been successfully
|
||||
* activated.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_activate);
|
||||
|
||||
/*
|
||||
* Occurs when an activated interface is being deactivated.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_deactivate);
|
||||
|
||||
/*
|
||||
* Occurs when an interface has been successfully enabled.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_enable);
|
||||
|
||||
/*
|
||||
* Occurs when an enabled interface is being disabled.
|
||||
*/
|
||||
DEFINE_INTERFACE_EVENT(gb_interface_disable);
|
||||
|
||||
#undef DEFINE_INTERFACE_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"
|
||||
|
||||
#define GB_INTERFACE_DEVICE_ID_BAD 0xff
|
||||
|
||||
|
@ -326,6 +327,8 @@ static void gb_interface_release(struct device *dev)
|
|||
{
|
||||
struct gb_interface *intf = to_gb_interface(dev);
|
||||
|
||||
trace_gb_interface_release(intf);
|
||||
|
||||
kfree(intf);
|
||||
}
|
||||
|
||||
|
@ -375,6 +378,8 @@ struct gb_interface *gb_interface_create(struct gb_module *module,
|
|||
dev_set_name(&intf->dev, "%s.%u", dev_name(&module->dev),
|
||||
interface_id);
|
||||
|
||||
trace_gb_interface_create(intf);
|
||||
|
||||
return intf;
|
||||
}
|
||||
|
||||
|
@ -506,6 +511,8 @@ int gb_interface_activate(struct gb_interface *intf)
|
|||
|
||||
intf->active = true;
|
||||
|
||||
trace_gb_interface_activate(intf);
|
||||
|
||||
return 0;
|
||||
|
||||
err_hibernate_link:
|
||||
|
@ -530,6 +537,8 @@ void gb_interface_deactivate(struct gb_interface *intf)
|
|||
if (!intf->active)
|
||||
return;
|
||||
|
||||
trace_gb_interface_deactivate(intf);
|
||||
|
||||
gb_interface_route_destroy(intf);
|
||||
gb_interface_hibernate_link(intf);
|
||||
gb_interface_unipro_set(intf, false);
|
||||
|
@ -629,6 +638,8 @@ int gb_interface_enable(struct gb_interface *intf)
|
|||
|
||||
intf->enabled = true;
|
||||
|
||||
trace_gb_interface_enable(intf);
|
||||
|
||||
return 0;
|
||||
|
||||
err_destroy_bundles:
|
||||
|
@ -658,6 +669,8 @@ void gb_interface_disable(struct gb_interface *intf)
|
|||
if (!intf->enabled)
|
||||
return;
|
||||
|
||||
trace_gb_interface_disable(intf);
|
||||
|
||||
/*
|
||||
* Disable the control-connection early to avoid operation timeouts
|
||||
* when the interface is already gone.
|
||||
|
@ -687,6 +700,8 @@ int gb_interface_add(struct gb_interface *intf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
trace_gb_interface_add(intf);
|
||||
|
||||
dev_info(&intf->dev, "Interface added: VID=0x%08x, PID=0x%08x\n",
|
||||
intf->vendor_id, intf->product_id);
|
||||
dev_info(&intf->dev, "DDBL1 Manufacturer=0x%08x, Product=0x%08x\n",
|
||||
|
@ -699,6 +714,8 @@ int gb_interface_add(struct gb_interface *intf)
|
|||
void gb_interface_del(struct gb_interface *intf)
|
||||
{
|
||||
if (device_is_registered(&intf->dev)) {
|
||||
trace_gb_interface_del(intf);
|
||||
|
||||
device_del(&intf->dev);
|
||||
dev_info(&intf->dev, "Interface removed\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue