drm: Move debug macros out of drmP.h
Subsystems (3)
v2 cover drm: Move debug macros out of drmP.h
This patchset move debug macros from drmP.h into debug.h and move printting related functions from drm_drv.[hc] to drm_debug.[hc]. In addition, it fixes old comment style and add kerneldoc comments for exported functions to avoid kerneldoc warning.
Changes in v2:
- Place kerneldoc include directives in drm-internals.rst
- Fix kerneldoc comments in drm_debug.h
- include patch 3 to add kerneldoc comments to exported functions
Haneen Mohammed (3):
drm: Extract drm_debug.[hc]
drm: Update old comment style
drm/debug: Add missing kerneldoc comments to exported functions
Documentation/gpu/drm-internals.rst | 8 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_debug.c | 92 ++++++++++++++++++ drivers/gpu/drm/drm_drv.c | 47 --------- include/drm/drmP.h | 149 +---------------------------- include/drm/drm_debug.h | 185 ++++++++++++++++++++++++++++++++++++ include/drm/drm_drv.h | 7 -- 7 files changed, 287 insertions(+), 203 deletions(-) create mode 100644 drivers/gpu/drm/drm_debug.c create mode 100644 include/drm/drm_debug.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/3 drm: Extract drm_debug.[hc]
Extract DRM_* debug macros from drmP.h to drm_debug.h and move printting related functions from drm_drv.[hc] to drm_debug.[hc].
Update kerneldoc include directives accordingly.
---
Changes in v2:
- Place kerneldoc include directives in drm-internals.rst
Documentation/gpu/drm-internals.rst | 8 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_debug.c | 75 ++++++++++++++ drivers/gpu/drm/drm_drv.c | 47 --------- include/drm/drmP.h | 149 +--------------------------- include/drm/drm_debug.h | 193 ++++++++++++++++++++++++++++++++++++ include/drm/drm_drv.h | 7 -- 7 files changed, 278 insertions(+), 203 deletions(-) create mode 100644 drivers/gpu/drm/drm_debug.c create mode 100644 include/drm/drm_debug.h
Documentation/gpu/drm-internals.rst +8 -0
@@ -230,6 +230,14 @@ Printer .. kernel-doc:: drivers/gpu/drm/drm_print.c :export: +Debug Support +------------- + +.. kernel-doc:: include/drm/drm_debug.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_debug.c + :export: Legacy Support Code ===================
drivers/gpu/drm/Makefile +1 -1
@@ -3,7 +3,7 @@ # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. drm-y := drm_auth.o drm_bufs.o drm_cache.o \ - drm_context.o drm_dma.o \ + drm_context.o drm_dma.o drm_debug.o \ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o \ drm_scatter.o drm_pci.o \
drivers/gpu/drm/drm_debug.c new file +75 -0
75 lines not on this page · raw message
drivers/gpu/drm/drm_drv.c +0 -47
53 lines not on this page · raw message
include/drm/drmP.h +1 -148
161 lines not on this page · raw message
include/drm/drm_debug.h new file +193 -0
193 lines not on this page · raw message
include/drm/drm_drv.h +0 -7
@@ -592,13 +592,6 @@ struct drm_driver {int dev_priv_size; }; -__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, ...); -__printf(3, 4) -void drm_printk (const char *level,unsigned int category, -const char *format, ...);extern unsigned int drm_debug; int drm_dev_init(struct drm_device *dev,
Signature · 1 line
2.7.4
PATCH v2 2/3 drm: Update old comment style
In reply to Haneen MohammedRemove old comment style used by doxygen.
And remove comment left from commit 99cdb35e787b ("drm/doc: move printf helpers out of drmP.h") after refactoring drmP.h.
---
Changes in v2:
- Fix kerneldoc comments
include/drm/drm_debug.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
include/drm/drm_debug.h +9 -17
@@ -42,9 +42,7 @@ __printf(3, 4)void drm_printk (const char *level,unsigned int category,const char *format, ...); -/***********************************************************************/ -/** \name Macros to make printk easier */ -/*@{*/ +/** Macros to make printk easier */ #define _DRM_PRINTK (once, level, fmt, ...) \ do { \
@@ -69,8 +67,8 @@ void drm_printk(const char *level, unsigned int category,/** * Error output. * -* \param fmt printf() like format string. -* \param arg arguments +* @dev: device pointer +* @fmt: printf() like format string. */ #define DRM_DEV_ERROR (dev, fmt, ...) \ drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
@@ -81,8 +79,8 @@ void drm_printk(const char *level, unsigned int category,/** * Rate limited error output. Like DRM_ERROR() but won't flood the log. * -* \param fmt printf() like format string. -* \param arg arguments +* @dev: device pointer +* @fmt: printf() like format string. */ #define DRM_DEV_ERROR_RATELIMITED (dev, fmt, ...) \ ({ \
@@ -112,8 +110,8 @@ void drm_printk(const char *level, unsigned int category,/** * Debug output. * -* \param fmt printf() like format string. -* \param arg arguments +* @dev: device pointer +* @fmt: printf() like format string. */ #define DRM_DEV_DEBUG(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \
@@ -164,8 +162,8 @@ void drm_printk(const char *level, unsigned int category,/** * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. * -* \param fmt printf() like format string. -* \param arg arguments +* @dev: device pointer +* @fmt: printf() like format string. */ #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...) \ DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
@@ -184,10 +182,4 @@ void drm_printk(const char *level, unsigned int category, #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args) -/* Format strings and argument splitters to simplify printing -* various "complex" objects -*/ - -/*@}*/ -#endif /* _DRM_DEBUG_H_ */
Signature · 1 line
2.7.4
PATCH v2 3/3 drm/debug: Add missing kerneldoc comments to exported functions
In reply to Haneen MohammedAdd missing documentation for exported functions to avoid kerneldoc warning.
---
Changes in v2:
- Include this patch to avoid kerneldoc warning
drivers/gpu/drm/drm_debug.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/drm_debug.c +17 -0
@@ -29,6 +29,16 @@#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV" +/** +* drm_dev_printk +* +* @dev: device pointer +* @level: logging level +* @category: debug category +* @function_name: function name +* @prefix: prefix string +* @format: printf() like format string +*/ void drm_dev_printk (const struct device *dev,const char *level,unsigned int category,const char *function_name,const char *prefix,const char *format, ...)
@@ -53,6 +63,13 @@ void drm_dev_printk(const struct device *dev, const char *level, }EXPORT_SYMBOL (drm_dev_printk); +/** +* drm_printk +* +* @level: logging level +* @category: debug category +* @format: printf() like format string +*/ void drm_printk (const char *level,unsigned int category,const char *format, ...) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/3] drm: Extract drm_debug.[hc]
In reply to Haneen MohammedQuoting Haneen Mohammed (2017-10-12 03:32:53)
Quoted 71 lines
drivers/gpu/drm/drm_debug.c new file +65
-0@@ -0,0 +1,75 @@ +/* +* Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. +* All Rights Reserved. +* +* Author Rickard E. (Rik) Faith <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include <drm/drm_debug.h> +#include <drm/drmP.h> + +#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, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format); + vaf.fmt = format; + vaf.va = &args; + +if (dev) +dev_printk (level, dev,DRM_PRINTK_FMT , function_name, prefix, + &vaf); +else +printk ("%s" DRM_PRINTK_FMT , level, function_name, prefix, &vaf); + +va_end (args); +} +EXPORT_SYMBOL (drm_dev_printk); + +void drm_printk (const char *level,unsigned int category, +const char *format, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format);
drivers/gpu/drm/drm_debug.c line 75
Quoted 10 lines
drivers/gpu/drm/drm_debug.c new file +10
-0+ vaf.fmt = format; + vaf.va = &args; + +printk ("%s" "[" DRM_NAME ":%ps]%s %pV" , + level,__builtin_return_address (0 ), +strcmp (level,KERN_ERR ) ==0 ?" *ERROR*" :"" , &vaf); + +va_end (args); +} +EXPORT_SYMBOL (drm_printk);
We already have drm_print.c, currently used to house drm_printf and the drm_printer. It might be a bit confusing to have drm_printk and drm_printf next to each other, but less confusing that calling user error messages drm_debug.c.
-Chris
kbuild test robot
build botRe: [PATCH v2 1/3] drm: Extract drm_debug.[hc]
In reply to Haneen Mohammedreproduce:
Hi Haneen,
[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Move-debug-macros-out-of-drmP-h/20171013-055510 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: i386-randconfig-c0-10130904 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/drm_debug.c:27:0:
>> include/drm/drm_debug.h:40:7: warning: 'struct device' declared inside parameter list
const char *prefix, const char *format, ...);
^
>> include/drm/drm_debug.h:40:7: warning: its scope is only this definition or declaration, which is probably not what you want drivers/gpu/drm/drm_debug.c:32:6: error: conflicting types for 'drm_dev_printk'
void drm_dev_printk(const struct device *dev, const char *level,
^
In file included from drivers/gpu/drm/drm_debug.c:27:0:
include/drm/drm_debug.h:38:6: note: previous declaration of 'drm_dev_printk' was here
void drm_dev_printk(const struct device *dev, const char *level,
^
--
In file included from drivers/gpu//drm/drm_debug.c:27:0:
>> include/drm/drm_debug.h:40:7: warning: 'struct device' declared inside parameter list
const char *prefix, const char *format, ...);
^
>> include/drm/drm_debug.h:40:7: warning: its scope is only this definition or declaration, which is probably not what you want drivers/gpu//drm/drm_debug.c:32:6: error: conflicting types for 'drm_dev_printk'
void drm_dev_printk(const struct device *dev, const char *level,
^
In file included from drivers/gpu//drm/drm_debug.c:27:0:
include/drm/drm_debug.h:38:6: note: previous declaration of 'drm_dev_printk' was here
void drm_dev_printk(const struct device *dev, const char *level,
^
vim +40 include/drm/drm_debug.h
36
37 __printf(6, 7)
38 void drm_dev_printk(const struct device *dev, const char *level,
39 unsigned int category, const char *function_name,
> 40 const char *prefix, const char *format, ...);
41 __printf(3, 4)
42 void drm_printk(const char *level, unsigned int category,
43 const char *format, ...);
44 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/3] drm: Extract drm_debug.[hc]
In reply to Chris WilsonQuoted 80 lines · Chris Wilson
Quoting Haneen Mohammed (2017-10-12 03:32:53)
Quoted 79 lines
drivers/gpu/drm/drm_debug.c new file +73
-0@@ -0,0 +1,75 @@ +/* +* Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. +* All Rights Reserved. +* +* Author Rickard E. (Rik) Faith <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include <drm/drm_debug.h> +#include <drm/drmP.h> + +#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, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format); + vaf.fmt = format; + vaf.va = &args; + +if (dev) +dev_printk (level, dev,DRM_PRINTK_FMT , function_name, prefix, + &vaf); +else +printk ("%s" DRM_PRINTK_FMT , level, function_name, prefix, &vaf); + +va_end (args); +} +EXPORT_SYMBOL (drm_dev_printk); + +void drm_printk (const char *level,unsigned int category, +const char *format, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format); + vaf.fmt = format; + vaf.va = &args; + +printk ("%s" "[" DRM_NAME ":%ps]%s %pV" , + level,__builtin_return_address (0 ), +strcmp (level,KERN_ERR ) ==0 ?" *ERROR*" :"" , &vaf); + +va_end (args);
Quoted 8 lines
drivers/gpu/drm/drm_debug.c line 75
Quoted 2 lines
drivers/gpu/drm/drm_debug.c new file +2
-0+} +EXPORT_SYMBOL (drm_printk);We already have
drm_print.c, currently used to housedrm_printfand thedrm_printer. It might be a bit confusing to havedrm_printkanddrm_printfnext to each other, but less confusing that calling user error messagesdrm_debug.c.
-Chris
I didn't notice that.
Should I move these functions and macros to drm_print.[hc] instead then?
Haneen
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Outreachy kernel] Re: [PATCH v2 1/3] drm: Extract drm_debug.[hc]
Quoted 90 lines · Haneen Mohammed
Quoted 80 lines · Chris Wilson
Quoting Haneen Mohammed (2017-10-12 03:32:53)
Quoted 79 lines
drivers/gpu/drm/drm_debug.c new file +73
-0@@ -0,0 +1,75 @@ +/* +* Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. +* All Rights Reserved. +* +* Author Rickard E. (Rik) Faith <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include <drm/drm_debug.h> +#include <drm/drmP.h> + +#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, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format); + vaf.fmt = format; + vaf.va = &args; + +if (dev) +dev_printk (level, dev,DRM_PRINTK_FMT , function_name, prefix, + &vaf); +else +printk ("%s" DRM_PRINTK_FMT , level, function_name, prefix, &vaf); + +va_end (args); +} +EXPORT_SYMBOL (drm_dev_printk); + +void drm_printk (const char *level,unsigned int category, +const char *format, ...) +{ +struct va_format vaf; +va_list args; + +if (category !=DRM_UT_NONE && !(drm_debug & category)) +return ; + +va_start (args, format); + vaf.fmt = format; + vaf.va = &args; + +printk ("%s" "[" DRM_NAME ":%ps]%s %pV" , + level,__builtin_return_address (0 ), +strcmp (level,KERN_ERR ) ==0 ?" *ERROR*" :"" , &vaf); + +va_end (args);Quoted 8 lines
drivers/gpu/drm/drm_debug.c line 75
Quoted 2 lines
drivers/gpu/drm/drm_debug.c new file +2
-0+} +EXPORT_SYMBOL (drm_printk);We already have
drm_print.c, currently used to housedrm_printfand thedrm_printer. It might be a bit confusing to havedrm_printkanddrm_printfnext to each other, but less confusing that calling user error messagesdrm_debug.c.
-Chris
Quoted 2 lines
I didn't notice that.
Should I move these functions and macros to drm_print.[hc] instead then?
Yeah I think this makes sense, instead of having yet another file with some big overlap with drm_print.[hc]. That also solves the problem of where to put the kerneldoc include :-)
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [Outreachy kernel] [PATCH v2 3/3] drm/debug: Add missing kerneldoc comments to exported functions
In reply to Haneen MohammedQuoted 18 lines · Haneen Mohammed
Add missing documentation for exported functions to avoid kerneldoc warning.
Signed-off-by Haneen Mohammed <[email protected]>---
Changes in v2:
- Include this patch to avoid kerneldoc warningdrivers/gpu/drm/drm_debug.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/drm_debug.c +0
-0@@ -29,6 +29,16 @@#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
drivers/gpu/drm/drm_debug.c line 40
Quoted 10 lines
drivers/gpu/drm/drm_debug.c +9
-0+/** +* drm_dev_printk +* +* @dev: device pointer +* @level: logging level +* @category: debug category +* @function_name: function name +* @prefix: prefix string +* @format: printf() like format string
This shuts up kernel-doc complaining about missing doc entries, but not sure how useful this is. A sentence to what it does, and that drivers should use it through the provided DRM_DEV_* macros would be more informative. Similarly for the one below.
Thanks, Daniel
Quoted 27 lines
drivers/gpu/drm/drm_debug.c +8
-0+*/ void drm_dev_printk (const struct device *dev,const char *level,unsigned int category,const char *function_name,const char *prefix,const char *format, ...)@@ -53,6 +63,13 @@ void drm_dev_printk(const struct device *dev, const char *level, }EXPORT_SYMBOL (drm_dev_printk); +/** +* drm_printk +* +* @level: logging level +* @category: debug category +* @format: printf() like format string +*/ void drm_printk (const char *level,unsigned int category,const char *format, ...) {Signature · 8 lines
2.7.4 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/7fc383433d651ee4e81e2c132afdad57ad04b9dd.1507773977.git.hamohammed.sa%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch