]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: tracing: fix hd traces
authorAlex Elder <elder@linaro.org>
Tue, 24 May 2016 04:05:30 +0000 (23:05 -0500)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 27 May 2016 05:37:19 +0000 (22:37 -0700)
Currently there are two trace points defined for the Greybus host
device structure.  One records information when a message gets sent,
and another when it gets received.  Neither of these is really a
host device event.

We have trace points defined for messages that dump information
about all sent and received messages.  As a result, the information
about sending messages over a host is redundant, and can go away.
(Note that the message traces may need a little refinement so they
produce all desired information.)

Instead of these trace points, define some that are directly
related to the host device abstraction: when one is created,
added, deleted, or released (destroyed).  These do not require
a CPort ID or payload size, so eliminate those two parameters
from the host device trace point prototype.  Change the trace
information recorded for a host device to be just a subset of
interesting fields in a host device.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/core.c
drivers/staging/greybus/es2.c
drivers/staging/greybus/greybus_trace.h
drivers/staging/greybus/hd.c

index 6d6a2bbb591af9d316feafab6874c5dcd4d2fe94..b1a7b116843a2f6e87430c0c539b205891d2815b 100644 (file)
 #include "greybus.h"
 #include "greybus_trace.h"
 
-EXPORT_TRACEPOINT_SYMBOL_GPL(gb_host_device_send);
-EXPORT_TRACEPOINT_SYMBOL_GPL(gb_host_device_recv);
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_hd_create);
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_hd_release);
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_hd_add);
+EXPORT_TRACEPOINT_SYMBOL_GPL(gb_hd_del);
 
 /* Allow greybus to be disabled at boot if needed */
 static bool nogreybus;
index 5bd348f1fea4e58954cffa75225e115e490c7227..24fef349eb363160c02ededc50fc5014fa7b61c0 100644 (file)
@@ -16,8 +16,6 @@
 #include "greybus.h"
 #include "kernel_ver.h"
 #include "connection.h"
-#include "greybus_trace.h"
-
 
 /* Fixed CPort numbers */
 #define ES2_CPORT_CDSI0                16
@@ -469,7 +467,6 @@ static int message_send(struct gb_host_device *hd, u16 cport_id,
                          message->buffer, buffer_size,
                          cport_out_callback, message);
        urb->transfer_flags |= URB_ZERO_PACKET;
-       trace_gb_host_device_send(hd, cport_id, buffer_size);
        retval = usb_submit_urb(urb, gfp_mask);
        if (retval) {
                dev_err(&udev->dev, "failed to submit out-urb: %d\n", retval);
@@ -909,7 +906,6 @@ static void cport_in_callback(struct urb *urb)
        cport_id = gb_message_cport_unpack(header);
 
        if (cport_id_valid(hd, cport_id)) {
-               trace_gb_host_device_recv(hd, cport_id, urb->actual_length);
                greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
                                                        urb->actual_length);
        } else {
index ba93873ed0e02e2bb11206b5a32bb2d1cec24d0b..cbbc9596c78e098dd5b54b93f05001b3642c7a62 100644 (file)
@@ -158,45 +158,55 @@ DEFINE_OPERATION_EVENT(gb_operation_put_active);
 
 DECLARE_EVENT_CLASS(gb_host_device,
 
-       TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
-                size_t payload_size),
+       TP_PROTO(struct gb_host_device *hd),
 
-       TP_ARGS(hd, intf_cport_id, payload_size),
+       TP_ARGS(hd),
 
        TP_STRUCT__entry(
-               __string(name, dev_name(&hd->dev))
-               __field(u16, intf_cport_id)
-               __field(size_t, payload_size)
+               __field(int, bus_id)
+               __field(u8, num_cports)
+               __field(size_t, buffer_size_max)
        ),
 
        TP_fast_assign(
-               __assign_str(name, dev_name(&hd->dev))
-               __entry->intf_cport_id = intf_cport_id;
-               __entry->payload_size = payload_size;
+               __entry->bus_id = hd->bus_id;
+               __entry->num_cports = hd->num_cports;
+               __entry->buffer_size_max = hd->buffer_size_max;
        ),
 
-       TP_printk("greybus:%s if_id=%u l=%zu", __get_str(name),
-                 __entry->intf_cport_id, __entry->payload_size)
+       TP_printk("greybus: bus_id=%d num_cports=%hu mtu=%zu",
+               __entry->bus_id, __entry->num_cports,
+               __entry->buffer_size_max)
 );
 
 #define DEFINE_HD_EVENT(name)                                          \
                DEFINE_EVENT(gb_host_device, name,                      \
-                               TP_PROTO(struct gb_host_device *hd,     \
-                                       u16 intf_cport_id,              \
-                                       size_t payload_size),           \
-                               TP_ARGS(hd, intf_cport_id, payload_size))
+                               TP_PROTO(struct gb_host_device *hd),    \
+                               TP_ARGS(hd))
+
+/*
+ * Occurs after a new host device is successfully created, before
+ * its SVC has been set up.
+ */
+DEFINE_HD_EVENT(gb_hd_create);
+
+/*
+ * Occurs after the last reference to a host device has been
+ * dropped.
+ */
+DEFINE_HD_EVENT(gb_hd_release);
 
 /*
- * Occurs immediately before calling usb_submit_urb() to send a
- * message to the UniPro bridge.
+ * Occurs after a new host device has been added, after the
+ * connection to its SVC has * been enabled.
  */
-DEFINE_HD_EVENT(gb_host_device_send);
+DEFINE_HD_EVENT(gb_hd_add);
 
 /*
- * Occurs after receiving a UniPro message via the USB subsystem,
- * just prior to handing it to the Greybus core for handling.
+ * Occurs when a host device is being disconnected from the AP USB
+ * host controller.
  */
-DEFINE_HD_EVENT(gb_host_device_recv);
+DEFINE_HD_EVENT(gb_hd_del);
 
 #undef DEFINE_HD_EVENT
 
index fba6d766209f9457f455e0e4f595a5e9b3537dcd..f64b592187c082cfb05efa62ca490af07a503bfc 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/slab.h>
 
 #include "greybus.h"
-
+#include "greybus_trace.h"
 
 static struct ida gb_hd_bus_id_map;
 
@@ -87,6 +87,8 @@ void gb_hd_cport_release(struct gb_host_device *hd, u16 cport_id)
        }
 
        ida_simple_remove(&hd->cport_id_map, cport_id);
+
+       trace_gb_hd_release(hd);
 }
 
 static void gb_hd_release(struct device *dev)
@@ -168,6 +170,8 @@ struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver,
        device_initialize(&hd->dev);
        dev_set_name(&hd->dev, "greybus%d", hd->bus_id);
 
+       trace_gb_hd_create(hd);
+
        hd->svc = gb_svc_create(hd);
        if (!hd->svc) {
                dev_err(&hd->dev, "failed to create svc\n");
@@ -193,12 +197,16 @@ int gb_hd_add(struct gb_host_device *hd)
                return ret;
        }
 
+       trace_gb_hd_add(hd);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(gb_hd_add);
 
 void gb_hd_del(struct gb_host_device *hd)
 {
+       trace_gb_hd_del(hd);
+
        /*
         * Tear down the svc and flush any on-going hotplug processing before
         * removing the remaining interfaces.