From patchwork Wed Jan 24 16:18:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10183245 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 CDC4D60353 for ; Wed, 24 Jan 2018 23:08:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B671128928 for ; Wed, 24 Jan 2018 23:08:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB0D728942; Wed, 24 Jan 2018 23:08:36 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 1E73528928 for ; Wed, 24 Jan 2018 23:08:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 579FD6E6D4; Wed, 24 Jan 2018 23:08:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18F856E60C for ; Wed, 24 Jan 2018 16:18:57 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id 36so4652365wrh.1 for ; Wed, 24 Jan 2018 08:18:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kk4HeDHq13Ql0XUeElTYOlY+sxUxHKUHs4oRP5CS8xE=; b=ggRthO1Nvg/SBbTUWpQm/P7naUMX4uGEqKUgUBBoYSPkYCwFoKQ5Mxu8DdJWMkMcFn OIkD2YaEG3thzYyod3kYK+aLbCvZowwa+5BJOPtGsFqIKH40rjVVStMJTnasGZ0vRyPo 4f0iwSmi9e9W2VGPOMlKTK7KEYWz+zVijEgyOp3JpAVjjrB5iKxef0sfdiPXBlPfH8Dy sjveKuEN6nenoGebbI8ImhR0RPnIV+xZ6p2gRX+AxKQhLuhFIKDDQ60cpya2Aufqo1ka aTJ/P8g/CKsD6/wUBFo/OX1Nnwros4hUiJyLMG9dq75tKqQIHq9d19JVx7Q/Sqegynox uoNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kk4HeDHq13Ql0XUeElTYOlY+sxUxHKUHs4oRP5CS8xE=; b=gmXgZBOkrWRAIjh5DhnsAUD3BeYJOqTrfjDXSgpGNrLqCtGSyAh4fwxtDkAd3EHavr Cp9XJOTjPF4Yv8Oq5I3PlZ9mIIjg3LUNV+CUtj8Q26UfyQspl0XAgoRyoKKkldHEIk7d rINE9EH4KsoDbUjjxLAZm7hJG3V2gtpmWudr5BuHOT6KzDtiI2afjX4EmhAIs0Gar3wn nNEzUiUQI5ul3u32v/R3oIBSaWNDTOYRmed7YJ2yPFvoVVBYXHLib5RAZ5nxu+km3t4c RpM31BwqZovL9KnaG5bq7gxMUfIWie0WoYiK1MgR1xl5688NUKzz36UruuQafhg3+rgi ZowA== X-Gm-Message-State: AKwxyteETnN7QkvrVWLUWcw4rCGWXJTNxcaxaN1HLAGF59WTxvUeqDHa kQy9pDaAPWeU4zSwKM6KkjKM2A== X-Google-Smtp-Source: AH8x227yjNlnBaha//ndmylQ7871JYfZ2xzhMFNCvmvCpQIor0Db4vWilh0lwdopm7qWn5hntZK7sw== X-Received: by 10.223.176.39 with SMTP id f36mr5693182wra.113.1516810735790; Wed, 24 Jan 2018 08:18:55 -0800 (PST) Received: from localhost.localdomain ([95.146.148.3]) by smtp.gmail.com with ESMTPSA id y62sm5702609wrb.48.2018.01.24.08.18.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 08:18:55 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Subject: [RFC 5/6] drm: Respect driver set DRM_LOG_NAME in drm_dev_printk Date: Wed, 24 Jan 2018 16:18:20 +0000 Message-Id: <20180124161821.28780-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124161821.28780-1-tvrtko.ursulin@linux.intel.com> References: <20180124161821.28780-1-tvrtko.ursulin@linux.intel.com> X-Mailman-Approved-At: Wed, 24 Jan 2018 23:07:46 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin , David Airlie , dri-devel@lists.freedesktop.org, tursulin@ursulin.net, Daniel Vetter MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Same as the previous patch did for drm_printk, allow for the logging macros to pass in the driver set DRM_LOG_NAME for drm_dev_printk. Signed-off-by: Tvrtko Ursulin Cc: Daniel Vetter Cc: Gustavo Padovan Cc: Sean Paul Cc: David Airlie Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_print.c | 12 ++++++------ include/drm/drm_print.h | 31 ++++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 90d38c830392..f97bfcb7d882 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -63,11 +63,10 @@ void drm_printf(struct drm_printer *p, const char *f, ...) } EXPORT_SYMBOL(drm_printf); -#define DRM_PRINTK_FMT "[" DRM_LOG_NAME ":%s]%s %pV" - void drm_dev_printk(const struct device *dev, const char *level, unsigned int category, const char *function_name, - const char *prefix, const char *format, ...) + const char *prefix, const char *driver, + const char *format, ...) { struct va_format vaf; va_list args; @@ -80,10 +79,11 @@ void drm_dev_printk(const struct device *dev, const char *level, vaf.va = &args; if (dev) - dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix, - &vaf); + dev_printk(level, dev, "[%s:%s]%s %pV", driver, function_name, + prefix, &vaf); else - printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf); + printk("%s[%s:%s]%s %pV", level, driver, function_name, prefix, + &vaf); va_end(args); } diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index c6047de9cbcc..c4dfcd217bce 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -203,10 +203,11 @@ static inline struct drm_printer drm_debug_printer(const char *prefix) #define DRM_UT_STATE 0x40 #define DRM_UT_LEASE 0x80 -__printf(6, 7) +__printf(7, 8) void drm_dev_printk(const struct device *dev, const char *level, unsigned int category, const char *function_name, - const char *prefix, const char *format, ...); + const char *prefix, const char *driver, const char *format, + ...); __printf(4, 5) void drm_printk(const char *level, unsigned int category, const char *driver, const char *format, ...); @@ -241,7 +242,7 @@ void drm_printk(const char *level, unsigned int category, const char *driver, */ #define DRM_DEV_ERROR(dev, fmt, ...) \ drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ - fmt, ##__VA_ARGS__) + DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_ERROR(fmt, ...) \ drm_printk(KERN_ERR, DRM_UT_NONE, DRM_LOG_NAME, fmt, ##__VA_ARGS__) @@ -264,8 +265,8 @@ void drm_printk(const char *level, unsigned int category, const char *driver, DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__) #define DRM_DEV_INFO(dev, fmt, ...) \ - drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt, \ - ##__VA_ARGS__) + drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", \ + DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \ ({ \ @@ -283,38 +284,38 @@ void drm_printk(const char *level, unsigned int category, const char *driver, * @fmt: printf() like format string. */ #define DRM_DEV_DEBUG(dev, fmt, args...) \ - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \ - ##args) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", \ + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_CORE, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \ - fmt, ##args) + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG_DRIVER(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_DRIVER, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \ - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \ - ##args) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", \ + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG_KMS(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_KMS, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \ - fmt, ##args) + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG_PRIME(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_PRIME, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \ - fmt, ##args) + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG_ATOMIC(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \ - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \ - ##args) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "" \ + DRM_LOG_NAME, fmt, ##args) #define DRM_DEBUG_VBL(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_VBL, DRM_LOG_NAME, fmt, ##__VA_ARGS__) @@ -328,7 +329,7 @@ void drm_printk(const char *level, unsigned int category, const char *driver, DEFAULT_RATELIMIT_BURST); \ if (__ratelimit(&_rs)) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \ - __func__, "", fmt, ##args); \ + __func__, "", DRM_LOG_NAME, fmt, ##args);\ }) /**