drm: change drm_err return type to void
Subsystems (2)
PATCH 1/1 drm: change drm_err return type to void
The return value is not used by callers of this function nor by uses of the DRM_ERROR macro so change the function to return void.
---
This change is associated to a desire to eventually change printk to return void.
No x86 change in output size for drm_drv.o
drivers/gpu/drm/drm_drv.c | 7 ++----- include/drm/drmP.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -5
@@ -56,22 +56,19 @@ static struct idr drm_minors_idr;struct class *drm_class;static struct dentry *drm_debugfs_root; -int drm_err (const char *func,const char *format, ...) +void drm_err (const char *func,const char *format, ...) {struct va_format vaf;va_list args; -int r;va_start (args, format); vaf.fmt = format; vaf.va = &args; - r =printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf); +printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf);va_end (args); - -return r; }EXPORT_SYMBOL (drm_err);
include/drm/drmP.h +1 -1
@@ -124,7 +124,7 @@ extern __printf(2, 3)void drm_ut_debug_printk (const char *function_name,const char *format, ...); extern __printf(2, 3) -int drm_err(const char *func, const char *format, ...); +void drm_err(const char *func, const char *format, ...); /***********************************************************************/ /** \name DRM template customization defaults */
Quoted 5 lines · Joe Perches
The return value is not used by callers of this function nor by uses of the
DRM_ERRORmacro so change the function to return void.Signed-off-by Joe Perches <[email protected]>
Quoted 58 lines
---
This change is associated to a desire to eventually change printk to return void.No x86 change in output size for drm_drv.o
drivers/gpu/drm/drm_drv.c | 7 ++----- include/drm/drmP.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_drv.c +2
-5@@ -56,22 +56,19 @@ static struct idr drm_minors_idr;struct class *drm_class;static struct dentry *drm_debugfs_root; -int drm_err (const char *func,const char *format, ...) +void drm_err (const char *func,const char *format, ...) {struct va_format vaf;va_list args; -int r;va_start (args, format); vaf.fmt = format; vaf.va = &args; - r =printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf); +printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf);va_end (args); - -return r; }EXPORT_SYMBOL (drm_err);include/drm/drmP.h +1
-1@@ -124,7 +124,7 @@ extern __printf(2, 3)void drm_ut_debug_printk (const char *function_name,const char *format, ...); extern __printf(2, 3) -int drm_err(const char *func, const char *format, ...); +void drm_err(const char *func, const char *format, ...); /***********************************************************************/ /** \name DRM template customization defaults */_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Daniel Vetter
AppliedQuoted 8 lines · Jani Nikula
Quoted 5 lines · Joe Perches
The return value is not used by callers of this function nor by uses of the
DRM_ERRORmacro so change the function to return void.Signed-off-by Joe Perches <[email protected]>Reviewed-by Jani Nikula <[email protected]>
Merged into my topic/core-stuff branch to make sure it won't get lost. -Daniel
Quoted 67 lines
Quoted 60 lines
---
This change is associated to a desire to eventually change printk to return void.No x86 change in output size for drm_drv.o
drivers/gpu/drm/drm_drv.c | 7 ++----- include/drm/drmP.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_drv.c +2
-5@@ -56,22 +56,19 @@ static struct idr drm_minors_idr;struct class *drm_class;static struct dentry *drm_debugfs_root; -int drm_err (const char *func,const char *format, ...) +void drm_err (const char *func,const char *format, ...) {struct va_format vaf;va_list args; -int r;va_start (args, format); vaf.fmt = format; vaf.va = &args; - r =printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf); +printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf);va_end (args); - -return r; }EXPORT_SYMBOL (drm_err);include/drm/drmP.h +1
-1@@ -124,7 +124,7 @@ extern __printf(2, 3)void drm_ut_debug_printk (const char *function_name,const char *format, ...); extern __printf(2, 3) -int drm_err(const char *func, const char *format, ...); +void drm_err(const char *func, const char *format, ...); /***********************************************************************/ /** \name DRM template customization defaults */_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm: drm_err: Remove unnecessary __func__ argument
Removing the unnecessary drm_err __func__ argument by using the equivalent %pf and __builtin_return_address(0) makes the code smaller for every use of the DRM_ERROR macro.
For instance: (allmodconfig)
$ size drivers/gpu/drm/i915/i915.o* text data bss dec hex filename 922447 193257 296736 1412440 158d58 drivers/gpu/drm/i915/i915.o.new 928111 193257 296736 1418104 15a378 drivers/gpu/drm/i915/i915.o.old
--- drivers/gpu/drm/drm_drv.c | 5 +++-- include/drm/drmP.h | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_drv.c +3 -2
@@ -68,7 +68,7 @@ static struct idr drm_minors_idr;struct class *drm_class;static struct dentry *drm_debugfs_root; -void drm_err (const char *func,const char *format, ...) +void drm_err (const char *format, ...) {struct va_format vaf;va_list args;
@@ -78,7 +78,8 @@ void drm_err(const char *func, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf); +printk (KERN_ERR "[" DRM_NAME ":%pf] *ERROR* %pV" , +__builtin_return_address (0 ), &vaf);va_end (args); }
include/drm/drmP.h +4 -4
@@ -125,8 +125,8 @@ struct reservation_object; extern __printf(2, 3) void drm_ut_debug_printk(const char *function_name, const char *format, ...); -extern __printf(2, 3) -void drm_err(const char *func, const char *format, ...); +extern __printf(1, 2) +void drm_err(const char *format, ...); /***********************************************************************/ /** \name DRM template customization defaults */
@@ -168,7 +168,7 @@ void drm_err(const char *func, const char *format, ...);* \param arg arguments */ #define DRM_ERROR (fmt, ...) \ - drm_err(__func__, fmt, ##__VA_ARGS__) + drm_err(fmt, ##__VA_ARGS__)/** * Rate limited error output. Like DRM_ERROR() but won't flood the log.
@@ -183,7 +183,7 @@ void drm_err(const char *func, const char *format, ...); DEFAULT_RATELIMIT_BURST); \ \if (__ratelimit (&_rs)) \ - drm_err(__func__, fmt, ##__VA_ARGS__); \ + drm_err(fmt, ##__VA_ARGS__); \ })#define DRM_INFO (fmt, ...) \
Re: [PATCH] drm: drm_err: Remove unnecessary __func__ argument
Hi
Quoted 10 lines · Joe Perches
Removing the unnecessary
drm_err__func__argument by using the equivalent %pf and__builtin_return_address(0)makes the code smaller for every use of theDRM_ERRORmacro.For instance: (allmodconfig)
$ size drivers/gpu/drm/i915/i915.o* text data bss dec hex filename 922447 193257 296736 1412440 158d58 drivers/gpu/drm/i915/i915.o.new 928111 193257 296736 1418104 15a378 drivers/gpu/drm/i915/i915.o.old
You might want to mention that this requires a binary-search through kallsyms on each call. I guess that's the reason you didn't use it for drm_ut_debug_printk()? I'm fine with doing this on drm_err(). Looks good.
Thanks
David
Quoted 68 lines
Signed-off-by Joe Perches <[email protected]>--- drivers/gpu/drm/drm_drv.c | 5 +++-- include/drm/drmP.h | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_drv.c +3
-2@@ -68,7 +68,7 @@ static struct idr drm_minors_idr;struct class *drm_class;static struct dentry *drm_debugfs_root; -void drm_err (const char *func,const char *format, ...) +void drm_err (const char *format, ...) {struct va_format vaf;va_list args;@@ -78,7 +78,8 @@ void drm_err(const char *func, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV" , func, &vaf); +printk (KERN_ERR "[" DRM_NAME ":%pf] *ERROR* %pV" , +__builtin_return_address (0 ), &vaf);va_end (args); }include/drm/drmP.h +4
-4@@ -125,8 +125,8 @@ struct reservation_object; extern __printf(2, 3) void drm_ut_debug_printk(const char *function_name, const char *format, ...); -extern __printf(2, 3) -void drm_err(const char *func, const char *format, ...); +extern __printf(1, 2) +void drm_err(const char *format, ...); /***********************************************************************/ /** \name DRM template customization defaults */@@ -168,7 +168,7 @@ void drm_err(const char *func, const char *format, ...);* \param arg arguments */ #define DRM_ERROR (fmt, ...) \ - drm_err(__func__, fmt, ##__VA_ARGS__) + drm_err(fmt, ##__VA_ARGS__)/** * Rate limited error output. Like DRM_ERROR() but won't flood the log. @@ -183,7 +183,7 @@ void drm_err(const char *func, const char *format, ...); DEFAULT_RATELIMIT_BURST); \ \if (__ratelimit (&_rs)) \ - drm_err(__func__, fmt, ##__VA_ARGS__); \ + drm_err(fmt, ##__VA_ARGS__); \ })#define DRM_INFO (fmt, ...) \_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_err: Remove unnecessary __func__ argument
Quoted 9 lines · David Herrmann
Hi
Quoted 6 lines · Joe Perches
Removing the unnecessary
drm_err__func__argument by using the equivalent %pf and__builtin_return_address(0)makes the code smaller for every use of theDRM_ERRORmacro.For instance: (allmodconfig)
Quoted 7 lines
Quoted 4 lines
$ size drivers/gpu/drm/i915/i915.o* text data bss dec hex filename 922447 193257 296736 1412440 158d58 drivers/gpu/drm/i915/i915.o.new 928111 193257 296736 1418104 15a378 drivers/gpu/drm/i915/i915.o.oldYou might want to mention that this requires a binary-search through kallsyms on each call.
All these calls are infrequently taken error paths and the cost of the printk itself is _far_ higher than a binary search for the symbol.
Quoted 3 lines
I guess that's the reason you didn't use it for
drm_ut_debug_printk()? I'm fine with doing this ondrm_err(). Looks good.
No, the reason I didn't do it there is that those calls should really be consolidated and be able to use dynamic_debug. It'd be a separate patch.
cheers, Joe