From patchwork Mon May 16 22:56:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12851678 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDCD7C433F5 for ; Mon, 16 May 2022 23:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DNKcxsrfMCEREbnXYHBchIu3lEjQhh4TM2HyV2kaGII=; b=u/WbHvNEnl40I1 ZLarjmamp4PSyB1oRDGxsyIDXmk46lez2lm2a65F2ki3kkAqC9Gqbz0kZP8PP1ym44ZOB8/6NivGY dtma/o6tmAqiYQZa4fw655ZPgCBjrYESuU7Tp3PKQCvYxWe4W0T0yFS6aGC0+8nX+Hp6cP1RstMDY sPK+9YnnN7bc+6Zbmzm4fjRn0KAGGYQh/kxBlYa8nxXC9kOK7sYG3inL+eK+7VUZJf6e4M5MOYZkP g63q6S3KdxypCrfkh8L1i1OqFxj7XM6Aoc60V30mE2slP75+I4UMHSmTDe8x+1hhLDS3k/Msyx9XZ +Dvu9UuT4sOFFhqhvmqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqjtO-00Agih-M1; Mon, 16 May 2022 23:12:48 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqjeb-00AZPD-1P for linux-arm-kernel@lists.infradead.org; Mon, 16 May 2022 22:57:30 +0000 Received: by mail-il1-x12a.google.com with SMTP id j7so2188063ila.1 for ; Mon, 16 May 2022 15:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1Lorhsk0X7YamG5elji+uQ1/gsBB2n7Jli+kbKqhzIg=; b=jy+CCznjgA7L1dhgzXrr4jlT4O/diTgk+LIO0EH+xOiCnetz7+vDqqCckOORUlXdfi CwbbYXdjAEzXOKUPSTX6/VmeIFWkhbhW6DOgUbIdzS//muVJvPgXhoGRwiN5I+gPpauF z2Ce0S6NP/Ix2wJE5JYz8eqy3KBfT8W14Gnqg5d7ID/6i8fWFVXvE146qO2236dZ94US TsgPLIFIr1+C3maWaa7e8Lgk9n32ax4uyoSoHLIH73f91qMj32AUOSJeq3jMCkaQeAbA 1+tXve0thRfbAjtaHC4IQZhVeIlvuH4WQjH5GjXvsB+s5fReOsuRRcsln7eajDNk57/E Tysw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1Lorhsk0X7YamG5elji+uQ1/gsBB2n7Jli+kbKqhzIg=; b=EyDUJ5FJ8aGZAA9bI4ww4Qilhr8cepq5r4riTOjMuKLGmDTQoeoj3Sc/BXYp37bFgb 4my4sKNevX58NDPlZopk8mWs9cviDIngP+U0gMUe3xVqryEJq1uL3b9AeKu3FHyaD3x1 DUIAp9X7Ul/8P0BNwslJ82s5+0Q4Qylssa7Qo3AbRzVKE4Wh8AeRUI0P/jLShdEfsMXe 7iqynqc/S6Vl9PU82V4wDvHpdtkeOR6uNl7EjTF0s59CvNw38wHKqr/gw6+TfI69s30s TtQmyuRsmDoesTZSMhxyibCkpO+6UOjjKfx0MQHbpfrunrr5VwTPDXXHcDERaygHrNO9 BCWQ== X-Gm-Message-State: AOAM530mgPNqANFkQdpiSH/0VnT1ktPUZYc4KH1CpXszDhImNGbTbiY3 /ZIsZSAQZt4nLiZ9uCzUIRU= X-Google-Smtp-Source: ABdhPJxjJINasg3hAWp7d73zeGu9P4K3x20riV+fru35nOD3ueGvMgNUWGevc44ji4O03Dl/YneXMw== X-Received: by 2002:a05:6e02:218c:b0:2d1:2a75:7751 with SMTP id j12-20020a056e02218c00b002d12a757751mr2652901ila.22.1652741848590; Mon, 16 May 2022 15:57:28 -0700 (PDT) Received: from frodo.hsd1.co.comcast.net ([2601:284:8204:2010::dd9f]) by smtp.googlemail.com with ESMTPSA id k26-20020a02661a000000b0032b74686763sm3133949jac.76.2022.05.16.15.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 15:57:28 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, seanpaul@chromium.org, robdclark@gmail.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, quic_saipraka@quicinc.com, will@kernel.org, catalin.marinas@arm.com, quic_psodagud@quicinc.com, maz@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, mingo@redhat.com, jim.cromie@gmail.com Subject: [PATCH v2 22/27] drm_print: add _ddebug desc to drm_*dbg prototypes Date: Mon, 16 May 2022 16:56:35 -0600 Message-Id: <20220516225640.3102269-23-jim.cromie@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220516225640.3102269-1-jim.cromie@gmail.com> References: <20220516225640.3102269-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220516_155729_159732_43A89E94 X-CRM114-Status: GOOD ( 14.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a struct _ddebug ptr to drm_dbg() and drm_dev_dbg() protos, and upgrade their callers - the interposed macros added recently, to use _dynamic_func_call_no_desc(); ie drop the '_no_desc', since the factory macro's callees (these 2 functions) are now expecting the arg. This makes those functions controllable like pr_debug(). It also means that they don't get to use the decorations implemented by pr_debug(). DRM already has standards for logging/messaging; tossing optional decorations on top may not help. For CONFIG_DRM_USE_DYNAMIC_DEBUG=N, just pass null. Note: desc->class_id is redundant with category parameter, but its availability is dependent on desc. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_print.c | 23 +++++++++++++---------- include/drm/drm_print.h | 22 +++++++++++----------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 1b11a15366b7..1752b40b0189 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -265,8 +265,8 @@ void drm_dev_printk(const struct device *dev, const char *level, } EXPORT_SYMBOL(drm_dev_printk); -void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, - const char *format, ...) +void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev, + enum drm_debug_category category, const char *format, ...) { struct va_format vaf; va_list args; @@ -274,22 +274,25 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, if (!__drm_debug_enabled(category)) return; + /* we know we are printing for either syslog, tracefs, or both */ va_start(args, format); vaf.fmt = format; vaf.va = &args; - if (dev) - dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV", - __builtin_return_address(0), &vaf); - else - printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", - __builtin_return_address(0), &vaf); - + if (dev) { + if (desc->flags && _DPRINTK_FLAGS_PRINT) + dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV", + __builtin_return_address(0), &vaf); + } else { + if (desc->flags && _DPRINTK_FLAGS_PRINT) + printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", + __builtin_return_address(0), &vaf); + } va_end(args); } EXPORT_SYMBOL(__drm_dev_dbg); -void ___drm_dbg(enum drm_debug_category category, const char *format, ...) +void ___drm_dbg(struct _ddebug *desc, enum drm_debug_category category, const char *format, ...) { struct va_format vaf; va_list args; diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index ccd177236ab3..fc0f2f6c2b91 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -366,9 +366,9 @@ static inline bool drm_debug_enabled(enum drm_debug_category category) __printf(3, 4) void drm_dev_printk(const struct device *dev, const char *level, const char *format, ...); -__printf(3, 4) -void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, - const char *format, ...); +__printf(4, 5) +void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev, + enum drm_debug_category category, const char *format, ...); /** * DRM_DEV_ERROR() - Error output. @@ -418,11 +418,11 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) #define drm_dev_dbg(dev, cat, fmt, ...) \ - __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__) + __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__) #else #define drm_dev_dbg(dev, cat, fmt, ...) \ - _dynamic_func_call_no_desc(fmt, __drm_dev_dbg, \ - dev, cat, fmt, ##__VA_ARGS__) + _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg, \ + dev, cat, fmt, ##__VA_ARGS__) #endif /** @@ -525,17 +525,17 @@ void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category, * Prefer drm_device based logging over device or prink based logging. */ -__printf(2, 3) -void ___drm_dbg(enum drm_debug_category category, const char *format, ...); +__printf(3, 4) +void ___drm_dbg(struct _ddebug *desc, enum drm_debug_category category, const char *format, ...); __printf(1, 2) void __drm_err(const char *format, ...); #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -#define __drm_dbg(fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__) +#define __drm_dbg(fmt, ...) ___drm_dbg(NULL, fmt, ##__VA_ARGS__) #else #define __drm_dbg(cat, fmt, ...) \ - _dynamic_func_call_no_desc(fmt, ___drm_dbg, \ - cat, fmt, ##__VA_ARGS__) + _dynamic_func_call_cls(cat, fmt, ___drm_dbg, \ + cat, fmt, ##__VA_ARGS__) #endif /* Macros to make printk easier */