From patchwork Tue Dec 6 18:57:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9463669 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 24FAA60459 for ; Wed, 7 Dec 2016 00:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15000284D9 for ; Wed, 7 Dec 2016 00:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09E21284F2; Wed, 7 Dec 2016 00:54:58 +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 6CF88284D9 for ; Wed, 7 Dec 2016 00:54:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 753E66E4D1; Wed, 7 Dec 2016 00:54:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC3C76E414 for ; Tue, 6 Dec 2016 18:58:19 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id a20so23403060wme.2 for ; Tue, 06 Dec 2016 10:58:19 -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=wsxQ2rewpR8UN+8JQtOkJuc61GvDqsDKG4PrMZz+RyE=; b=LVTE5cOpgy5WfcllHS+haP2R9IcIpTOoMflHcOT61SQFtsvFSnCWQqZbXG1yNGG1nt N8VqVGKuS/6wsfstL9kDbQf7+GEl3vetM0ZdrDrhHKnxOrjrQLQYJGARifKl9+ow5UO1 jjc0riqDBE6oYAlBpyhAPxXwdMiqXgLxhTXOpgPP4N6Yqh7k2gpSjpzyeTTAD5vX3JyI tvEoayFFK6Cto4UyWJZfON9ZHVKEZcaoZIp+nq/E1pHRlucmX3dda8lFGxwAGRQLDyp+ 5iWJf6cwH/KPWLgXf0/g8vSqaiJAZygXXMy2KtozBNsTp5/sZ5yhp2AbqbXsazEmMG35 8xJw== 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=wsxQ2rewpR8UN+8JQtOkJuc61GvDqsDKG4PrMZz+RyE=; b=TZzC/Ute423qtuFBhBN5gAEWTsvWchNaigcCQd+CWsLqLdvDSRJwX7073tWePDOMU1 1KGjO6NcpJ5gWpQ+vzwHNNFJBfJrcoTdfPa1PRrGhO5+CP9cLyJIUkyiSjhq5psViCg5 34MwYp4AkCL3GHuBpbKUz3y2uH2QOlVWiSSliXbyEPImFcqPk6ONDB6JvQU4W66QqYkf HZrTgaU7KPv/Pesz0hkGg8HV+RP6zSnu70ZSP16lNvTVkJH5xMLRq0WN4xFBVznwL6kr +l6a5wFJ4Im+/BHIvENcQHWPgk+rL0tzglnSUCcfH2mFBZGxWY+HdpbEoJ2bjrM2h5O1 qrBg== X-Gm-Message-State: AKaTC00UghAks5aWbIybvb6YlwyuTC7Ll8J7zV6kHZ5HXHic1pCxyS3dOvoUspTI06VEKQ== X-Received: by 10.28.46.144 with SMTP id u138mr52881wmu.136.1481050698249; Tue, 06 Dec 2016 10:58:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 10:58:17 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Subject: [RFC 3/5] drm: Respect driver set DRM_NAME in drm_dev_printk Date: Tue, 6 Dec 2016 18:57:59 +0000 Message-Id: <1481050681-23416-4-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 Same as the previous patch did for drm_printk, allow for the logging macros to pass in the driver set DRM_NAME. Signed-off-by: Tvrtko Ursulin --- drivers/gpu/drm/drm_drv.c | 14 +++++++------- drivers/gpu/drm/i915/i915_drv.c | 3 ++- include/drm/drmP.h | 36 ++++++++++++++++++------------------ include/drm/drm_drv.h | 7 ++++--- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index f6b674b03db9..a2f4eb4509b9 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -65,11 +65,10 @@ static struct idr drm_minors_idr; static struct dentry *drm_debugfs_root; -#define DRM_PRINTK_FMT "[" DRM_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, ...) + unsigned int category, const char *driver, + const char *function_name, const char *prefix, + const char *format, ...) { struct va_format vaf; va_list args; @@ -82,10 +81,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:%ps]%s %pV", + driver, function_name, prefix, &vaf); else - printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf); + printk("%s[%s:%ps]%s %pV", + level, driver, function_name, prefix, &vaf); va_end(args); } diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 78b2d03bf808..77d82fce371d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -101,7 +101,8 @@ i915_load_error(struct drm_i915_private *dev_priv, const char *fmt, ...) vaf.fmt = fmt; vaf.va = &args; - drm_dev_printk(kdev, level, DRM_UT_DRIVER, __func__, "", fmt, &vaf); + drm_dev_printk(kdev, level, DRM_UT_DRIVER, DRM_NAME, __func__, "", + fmt, &vaf); va_end(args); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index eedfbe51795a..8661045ffaf1 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -173,8 +173,8 @@ struct dma_buf_attachment; * \param arg arguments */ #define DRM_DEV_ERROR(dev, fmt, ...) \ - drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ - fmt, ##__VA_ARGS__) + drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, DRM_NAME, __func__, \ + " *ERROR*", fmt, ##__VA_ARGS__) #define DRM_ERROR(fmt, ...) \ drm_printk(KERN_ERR, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__) @@ -197,8 +197,8 @@ struct dma_buf_attachment; 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, DRM_NAME, __func__, \ + "", fmt, ##__VA_ARGS__) #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \ ({ \ @@ -216,38 +216,38 @@ struct dma_buf_attachment; * \param arg arguments */ #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, DRM_NAME, __func__,\ + "", fmt, ##args) #define DRM_DEBUG(fmt, ...) \ 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) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, DRM_NAME, \ + __func__, "", fmt, ##args) #define DRM_DEBUG_DRIVER(fmt, ...) \ 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_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, DRM_NAME, __func__, \ + "", fmt, ##args) +#define DRM_DEBUG_KMS(fmt, ...) \ 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) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, DRM_NAME, \ + __func__, "", fmt, ##args) #define DRM_DEBUG_PRIME(fmt, ...) \ 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) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, DRM_NAME, \ + __func__, "", fmt, ##args) #define DRM_DEBUG_ATOMIC(fmt, ...) \ 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) + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, DRM_NAME, __func__, \ + "", fmt, ##args) #define DRM_DEBUG_VBL(fmt, ...) \ drm_printk(KERN_DEBUG, DRM_UT_VBL, DRM_NAME, fmt, ##__VA_ARGS__) @@ -258,7 +258,7 @@ struct dma_buf_attachment; DEFAULT_RATELIMIT_BURST); \ if (__ratelimit(&_rs)) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \ - __func__, "", fmt, ##args); \ + DRM_NAME, __func__, "", fmt, ##args); \ }) /** diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0ad6cde5757b..8299c13004df 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -407,10 +407,11 @@ struct drm_driver { struct list_head legacy_dev_list; }; -extern __printf(6, 7) +extern __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, ...); + unsigned int category, const char *driver, + const char *function_name, const char *prefix, + const char *format, ...); extern __printf(4, 5) void drm_printk(const char *level, unsigned int category, const char *driver, const char *format, ...);