From patchwork Wed Nov 22 10:55:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10070249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1054601D5 for ; Wed, 22 Nov 2017 10:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA7D829C6C for ; Wed, 22 Nov 2017 10:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE71D29C70; Wed, 22 Nov 2017 10:55:33 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D7C029C6C for ; Wed, 22 Nov 2017 10:55:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A7496E2F5; Wed, 22 Nov 2017 10:55:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5730B6E2F4; Wed, 22 Nov 2017 10:55:30 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 9689974-1500050 for multiple; Wed, 22 Nov 2017 10:55:19 +0000 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Wed, 22 Nov 2017 10:55:19 +0000 From: Chris Wilson To: airlied@redhat.com Subject: [PATCH v3] drm/printer: Add drm_vprintf() Date: Wed, 22 Nov 2017 10:55:13 +0000 Message-Id: <20171122105513.5269-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171121093941.15459-1-chris@chris-wilson.co.uk> References: <20171121093941.15459-1-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Simple va_args equivalent to the existing drm_printf() for use with the drm_printer. v2: Fixup kerneldoc to match final parameter names. v3: Turn it into a kerneldoc comment Signed-off-by: Chris Wilson Cc: Rob Clark Reviewed-by: Daniel Vetter Cc: Dave Airlie --- Dave, could you ack this for merging via drm/i915? Thanks, -Chris --- drivers/gpu/drm/drm_print.c | 5 +---- include/drm/drm_print.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 82ff327eb2df..781518fd88e3 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,13 +55,10 @@ EXPORT_SYMBOL(__drm_printfn_debug); */ void drm_printf(struct drm_printer *p, const char *f, ...) { - struct va_format vaf; va_list args; va_start(args, f); - vaf.fmt = f; - vaf.va = &args; - p->printfn(p, &vaf); + drm_vprintf(p, f, &args); va_end(args); } EXPORT_SYMBOL(drm_printf); diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0968e411f562..5f9932e2246e 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -80,6 +80,21 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); __printf(2, 3) void drm_printf(struct drm_printer *p, const char *f, ...); +/** + * drm_vprintf - print to a &drm_printer stream + * @p: the &drm_printer + * @fmt: format string + * @va: the va_list + */ +__printf(2, 0) +static inline void +drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va) +{ + struct va_format vaf = { .fmt = fmt, .va = va }; + + p->printfn(p, &vaf); +} + /** * drm_printf_indent - Print to a &drm_printer stream with indentation * @printer: DRM printer