diff mbox series

spi: atmel: add tracing to custom .transfer_one_message callback

Message ID 20190801204710.27309-1-uwe@kleine-koenig.org (mailing list archive)
State Accepted
Commit 3c0448d507d42605ab6811bcd61c1cd94390d2d8
Headers show
Series spi: atmel: add tracing to custom .transfer_one_message callback | expand

Commit Message

Uwe Kleine-König Aug. 1, 2019, 8:47 p.m. UTC
Driver specific implementations for .transfer_one_message need to call
the tracing stuff themself. This is necessary to make spi tracing
actually useful.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 drivers/spi/spi-atmel.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mark Brown Aug. 1, 2019, 11:40 p.m. UTC | #1
On Thu, Aug 01, 2019 at 10:47:10PM +0200, Uwe Kleine-König wrote:
> Driver specific implementations for .transfer_one_message need to call
> the tracing stuff themself. This is necessary to make spi tracing
> actually useful.

Have you tested this for modular builds?  IIRC it breaks unfortunately.
Uwe Kleine-König Aug. 2, 2019, 6:20 a.m. UTC | #2
Hey Mark,

On Fri, Aug 02, 2019 at 12:40:11AM +0100, Mark Brown wrote:
> On Thu, Aug 01, 2019 at 10:47:10PM +0200, Uwe Kleine-König wrote:
> > Driver specific implementations for .transfer_one_message need to call
> > the tracing stuff themself. This is necessary to make spi tracing
> > actually useful.
> 
> Have you tested this for modular builds?  IIRC it breaks unfortunately.

Works for me. Is this just a suspicion or do you have a breaking
.config? If the latter, the spi-mxs driver probably has the same
problem. When I sent the analogous patch for mxs this was indeed a
problem, but this was fixed in
ca1438dcb34c7fcad63b6ce14ea63a870b92a69b.

Best regards
Uwe
Mark Brown Aug. 2, 2019, 10:51 a.m. UTC | #3
On Fri, Aug 02, 2019 at 08:20:18AM +0200, Uwe Kleine-König wrote:
> On Fri, Aug 02, 2019 at 12:40:11AM +0100, Mark Brown wrote:
> > On Thu, Aug 01, 2019 at 10:47:10PM +0200, Uwe Kleine-König wrote:

> > Have you tested this for modular builds?  IIRC it breaks unfortunately.

> Works for me. Is this just a suspicion or do you have a breaking
> .config? If the latter, the spi-mxs driver probably has the same
> problem. When I sent the analogous patch for mxs this was indeed a
> problem, but this was fixed in
> ca1438dcb34c7fcad63b6ce14ea63a870b92a69b.

It was a problem I remember happening in the past.
diff mbox series

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index f00b367523cd..acf318e7330c 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -23,6 +23,7 @@ 
 #include <linux/gpio/consumer.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
+#include <trace/events/spi.h>
 
 /* SPI register offsets */
 #define SPI_CR					0x0000
@@ -1409,9 +1410,13 @@  static int atmel_spi_transfer_one_message(struct spi_master *master,
 	msg->actual_length = 0;
 
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
+		trace_spi_transfer_start(msg, xfer);
+
 		ret = atmel_spi_one_transfer(master, msg, xfer);
 		if (ret)
 			goto msg_done;
+
+		trace_spi_transfer_stop(msg, xfer);
 	}
 
 	if (as->use_pdc)