From patchwork Tue Jul 5 22:45:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12907169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61536CCA481 for ; Tue, 5 Jul 2022 22:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232642AbiGEWtN (ORCPT ); Tue, 5 Jul 2022 18:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232544AbiGEWsN (ORCPT ); Tue, 5 Jul 2022 18:48:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D28E51CB01; Tue, 5 Jul 2022 15:47:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 386ADB81A3F; Tue, 5 Jul 2022 22:47:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A825C341E1; Tue, 5 Jul 2022 22:47:51 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.95) (envelope-from ) id 1o8rKg-001yKK-Av; Tue, 05 Jul 2022 18:47:50 -0400 Message-ID: <20220705224750.172301548@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 05 Jul 2022 18:45:00 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH 07/13] xhci: tracing: Use the new __vstring() helper References: <20220705224453.120955146@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: "Steven Rostedt (Google)" Instead of open coding a __dynamic_array() with a fixed length (which defeats the purpose of the dynamic array in the first place). Use the new __vstring() helper that will use a va_list and only write enough of the string into the ring buffer that is needed. Cc: Mathias Nyman Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Signed-off-by: Steven Rostedt (Google) --- drivers/usb/host/xhci-trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index a5da02077297..61e93a3540a7 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -28,9 +28,9 @@ DECLARE_EVENT_CLASS(xhci_log_msg, TP_PROTO(struct va_format *vaf), TP_ARGS(vaf), - TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)), + TP_STRUCT__entry(__vstring(msg, vaf->fmt, vaf->va)), TP_fast_assign( - vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va); + __assign_vstr(msg, vaf->fmt, vaf->va); ), TP_printk("%s", __get_str(msg)) );