From patchwork Tue Dec 6 18:57:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9463673 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 CF99B60459 for ; Wed, 7 Dec 2016 00:55:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C06EB284D9 for ; Wed, 7 Dec 2016 00:55:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B579E284F2; Wed, 7 Dec 2016 00:55:11 +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 5B13A284D9 for ; Wed, 7 Dec 2016 00:55:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CC706E4DD; Wed, 7 Dec 2016 00:54:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id E48306E40F for ; Tue, 6 Dec 2016 18:58:18 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id g23so23341054wme.1 for ; Tue, 06 Dec 2016 10:58:18 -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=4yORx41D5tRYc4pxxYfm2ZzC7zjjb08LwPD1tGmsbbY=; b=f+divo6cyM2k2g2gz/Uw9fIHbPecLC8dfLI4GK8oy7ue61oAXUqe1elrKI/selS9FC utfUn74aKR1wzE1KzkNIadSx3EXYV+7av22udwy3WREkxTBG34Qhsn0zxcvehhIg5C9u iKc4pdCHid7BJBEoH9g24skUmxjH7FvupvAES7E5t/a8OcGE3ahu1AMEGvnjrD1WRbfU EURRs/2NGYnvWdDUGc/wg59gZCTz3fV5ecuNK5uC+CQDB/CumTpgy0TyWtWIYStZbujf 7Htb/KzU+dvkY5+rruXKUQ08M5ecUu+QZZs6X5grftkoYPc8WyMXAnbCBIspiX8LYVCA 3xiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4yORx41D5tRYc4pxxYfm2ZzC7zjjb08LwPD1tGmsbbY=; b=h9AhuGrEGmejac4/a+FhVrNi1MUVW/FQEqIPxu9SToBmx8gNT4Pyw4ay5pynMxueod 6DDwR1fhCt/0tgdKkg4j/xy1D8hzZ3BIhTfpsnT87qAEcuB5aJfmTH4s1dXRLB5fVgKT 2OmfE0VP2HphYIcuG8q7df+3c/dcVf0kOvqmF9l+J9fJVtrrb6eJqiy0gpn+CknW2pvT Wr7OuuwMepKM/1tRj7vqMq6HDTw8z0HAvdAD/4Bw0vi5YZgblP0ibPTmEW11502e1VDQ jRAGK7UfD9yoDZXXNHD7SEt4oB2KU8Nked1N4E3+dbDCllssRP1K8lfc8M+aAvs0NXnu vM0g== X-Gm-Message-State: AKaTC016SCS6aM4ECmChNOGX9W8H4e/gMWByK1DOtwS30Ogi0BgapvFtn0rT5SDOFPd6eQ== X-Received: by 10.195.11.229 with SMTP id el5mr67374430wjd.64.1481050697220; Tue, 06 Dec 2016 10:58:17 -0800 (PST) Received: from t460p.intel ([2a02:c7d:9bd6:b000:f37e:1e07:a7d8:46cd]) by smtp.gmail.com with ESMTPSA id r7sm27173177wjp.43.2016.12.06.10.58.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 10:58:16 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Subject: [RFC 2/5] drm: Respect driver set DRM_NAME in drm_printk Date: Tue, 6 Dec 2016 18:57:58 +0000 Message-Id: <1481050681-23416-3-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481050681-23416-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1481050681-23416-1-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailman-Approved-At: Wed, 07 Dec 2016 00:54:15 +0000 Cc: Tvrtko Ursulin , dri-devel@lists.freedesktop.org, tursulin@ursulin.net 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 From: Tvrtko Ursulin Instead of logging with the DRM core name, pass in the name explicitly in order to allow individual drivers to have all their log messages prefixed with their own name. For instance i915, instead of: [drm:edp_panel_off [i915]] Wait for panel power off time would now log debug messages as: [i915:edp_panel_off [i915]] Wait for panel power off time Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/drm_drv.c | 6 +++--- include/drm/drmP.h | 14 +++++++------- include/drm/drm_drv.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index f74b7d06ec01..f6b674b03db9 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -92,7 +92,7 @@ void drm_dev_printk(const struct device *dev, const char *level, EXPORT_SYMBOL(drm_dev_printk); void drm_printk(const char *level, unsigned int category, - const char *format, ...) + const char *driver, const char *format, ...) { struct va_format vaf; va_list args; @@ -104,8 +104,8 @@ void drm_printk(const char *level, unsigned int category, vaf.fmt = format; vaf.va = &args; - printk("%s" "[" DRM_NAME ":%ps]%s %pV", - level, __builtin_return_address(0), + printk("%s[%s:%ps]%s %pV", + level, driver, __builtin_return_address(0), strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf); va_end(args); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a9cfd33c7b1a..eedfbe51795a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -176,7 +176,7 @@ struct dma_buf_attachment; drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ fmt, ##__VA_ARGS__) #define DRM_ERROR(fmt, ...) \ - drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__) + drm_printk(KERN_ERR, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__) /** * Rate limited error output. Like DRM_ERROR() but won't flood the log. @@ -219,37 +219,37 @@ struct dma_buf_attachment; drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \ ##args) #define DRM_DEBUG(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_CORE, DRM_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \ fmt, ##args) #define DRM_DEBUG_DRIVER(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_DRIVER, DRM_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \ ##args) #define DRM_DEBUG_KMS(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_KMS, DRM_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \ fmt, ##args) #define DRM_DEBUG_PRIME(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_PRIME, DRM_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \ fmt, ##args) #define DRM_DEBUG_ATOMIC(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, DRM_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \ ##args) #define DRM_DEBUG_VBL(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_VBL, DRM_NAME, fmt, ##__VA_ARGS__) #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \ ({ \ diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index c4fc49583dc0..0ad6cde5757b 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -411,9 +411,9 @@ extern __printf(6, 7) void drm_dev_printk(const struct device *dev, const char *level, unsigned int category, const char *function_name, const char *prefix, const char *format, ...); -extern __printf(3, 4) +extern __printf(4, 5) void drm_printk(const char *level, unsigned int category, - const char *format, ...); + const char *driver, const char *format, ...); extern unsigned int drm_debug; int drm_dev_init(struct drm_device *dev,