From patchwork Sat Apr 13 20:48:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 10899621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC856186D for ; Sat, 13 Apr 2019 20:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E4828B62 for ; Sat, 13 Apr 2019 20:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81DA128B76; Sat, 13 Apr 2019 20:49:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1649228B62 for ; Sat, 13 Apr 2019 20:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbfDMUtS (ORCPT ); Sat, 13 Apr 2019 16:49:18 -0400 Received: from smtp.domeneshop.no ([194.63.252.55]:50657 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbfDMUtS (ORCPT ); Sat, 13 Apr 2019 16:49:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org; s=ds201810; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=lBCflDYj9Vqk8oBmM1ZYSaE4yLTO8rrYKnW2rUm4vxE=; b=fJ3uNLbKnRYceGUgcKNrZ6yHuUIiwLEjnbwLXGvhYmT5BfyrfziQpsNQHtIJ2J5Fxul7LYhfMbD9ZFZ+LdGn5GyYmnH8hp3wlV50G//JD9NNKsXXS2XoCfMxXytiD8Mmo0Rj/q6oIideg+Pv3F4b3h1mbNcuyqbT05VPMwcBhHpx2PbSxsB8Ugyk8AZRYSvL0nxQJrDkErbP/9ajhok8NEddKyrvipcatQzQUSAdb/QbSPYQOE+HzZtD3GVh3LbciWFkZ4knEwsTx0MyDNvEoUd9eJDxAlRIfRcw+w9eobGlrC6sJMle0ZZaCe6bwp2BjX7d2+e9luUwTp5M75dHTw==; Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:50310 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.84_2) (envelope-from ) id 1hFPaO-0004fn-Md; Sat, 13 Apr 2019 22:49:16 +0200 From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: linux-spi@vger.kernel.org Cc: broonie@kernel.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH] spi/trace: Cap buffer contents at 64 bytes Date: Sat, 13 Apr 2019 22:48:55 +0200 Message-Id: <20190413204855.7819-1-noralf@tronnes.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Large transfers (64kB) doesn't show up in the trace. Not sure why, but since printk can only display buffers up to 64 bytes in length, we only need to store the first 64 bytes. Cc: Uwe Kleine-König Signed-off-by: Noralf Trønnes --- include/trace/events/spi.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h index aef6869f563d..0dd9171d2ad8 100644 --- a/include/trace/events/spi.h +++ b/include/trace/events/spi.h @@ -131,9 +131,11 @@ DECLARE_EVENT_CLASS(spi_transfer, __field( struct spi_transfer *, xfer ) __field( int, len ) __dynamic_array(u8, rx_buf, - spi_valid_rxbuf(msg, xfer) ? xfer->len : 0) + spi_valid_rxbuf(msg, xfer) ? + (xfer->len < 64 ? xfer->len : 64) : 0) __dynamic_array(u8, tx_buf, - spi_valid_txbuf(msg, xfer) ? xfer->len : 0) + spi_valid_txbuf(msg, xfer) ? + (xfer->len < 64 ? xfer->len : 64) : 0) ), TP_fast_assign( @@ -144,11 +146,11 @@ DECLARE_EVENT_CLASS(spi_transfer, if (spi_valid_txbuf(msg, xfer)) memcpy(__get_dynamic_array(tx_buf), - xfer->tx_buf, xfer->len); + xfer->tx_buf, __get_dynamic_array_len(tx_buf)); if (spi_valid_rxbuf(msg, xfer)) memcpy(__get_dynamic_array(rx_buf), - xfer->rx_buf, xfer->len); + xfer->rx_buf, __get_dynamic_array_len(rx_buf)); ), TP_printk("spi%d.%d %p len=%d tx=[%*phD] rx=[%*phD]",