drm: Reduce code size of drm_err and DRM_DEBUG[_<FOO>] uses
Subsystems (2)
PATCH 1/1 drm: Reduce code size of drm_err and DRM_DEBUG[_<FOO>] uses
Using %pf, __builtin_return_address(0) instead ofy "%s", __func__ reduces code size by eliminating a function argument.
(allyesconfig)
$ size drivers/gpu/drm/built-in.o* text data bss dec hex filename 4656061 1321947 1669536 7647544 74b138 drivers/gpu/drm/built-in.o.new 4737680 1321947 1669472 7729099 75efcb drivers/gpu/drm/built-in.o.old
--- drivers/gpu/drm/drm_drv.c | 10 ++++++---- include/drm/drmP.h | 45 ++++++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 27 deletions(-)
drivers/gpu/drm/drm_drv.c +6 -4
@@ -56,7 +56,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;
@@ -66,13 +66,14 @@ 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); }EXPORT_SYMBOL (drm_err); -void drm_ut_debug_printk (const char *function_name,const char *format, ...) +void drm_ut_debug_printk (const char *format, ...) {struct va_format vaf;va_list args;
@@ -81,7 +82,8 @@ void drm_ut_debug_printk(const char *function_name, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_DEBUG "[" DRM_NAME ":%s] %pV" , function_name, &vaf); +printk (KERN_DEBUG "[" DRM_NAME ":%pf] %pV" , +__builtin_return_address (0 ), &vaf);va_end (args); }
include/drm/drmP.h +22 -23
73 lines not on this page · raw message
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Joe Perches
Using %pf,
__builtin_return_address(0)instead ofy "%s",__func__reduces code size by eliminating a function argument.(allyesconfig)
$ size drivers/gpu/drm/built-in.o* text data bss dec hex filename 4656061 1321947 1669536 7647544 74b138 drivers/gpu/drm/built-in.o.new 4737680 1321947 1669472 7729099 75efcb drivers/gpu/drm/built-in.o.oldSigned-off-by Joe Perches <[email protected]>
I have an earlier version from you of this patch already, and it's in linux-next. And this patch here lacks the changelog indicating what changed exactly. Can you please rebase on top of linux-next and improve the commit message?
Thanks, Daniel
Quoted 132 lines
--- drivers/gpu/drm/drm_drv.c | 10 ++++++---- include/drm/drmP.h | 45 ++++++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 27 deletions(-)drivers/gpu/drm/drm_drv.c +6
-4@@ -56,7 +56,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;@@ -66,13 +66,14 @@ 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); }EXPORT_SYMBOL (drm_err); -void drm_ut_debug_printk (const char *function_name,const char *format, ...) +void drm_ut_debug_printk (const char *format, ...) {struct va_format vaf;va_list args;@@ -81,7 +82,8 @@ void drm_ut_debug_printk(const char *function_name, const char *format, ...) vaf.fmt = format; vaf.va = &args; -printk (KERN_DEBUG "[" DRM_NAME ":%s] %pV" , function_name, &vaf); +printk (KERN_DEBUG "[" DRM_NAME ":%pf] %pV" , +__builtin_return_address (0 ), &vaf);va_end (args); }include/drm/drmP.h +22
-23@@ -122,11 +122,10 @@ struct dma_buf_attachment;#define DRM_UT_KMS 0x04#define DRM_UT_PRIME 0x08 -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, ...); +__printf(1, 2) +void drm_ut_debug_printk (const char *format, ...); +__printf(1, 2) +void drm_err (const char *format, ...);/***********************************************************************/ /** \name DRM template customization defaults */ @@ -155,7 +154,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. @@ -170,7 +169,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, ...) \@@ -186,26 +185,26 @@ void drm_err(const char *func, const char *format, ...);* \param arg arguments */ #define DRM_DEBUG(fmt, args...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_CORE)) \ - drm_ut_debug_printk(__func__, fmt, ##args); \ - } while (0) +do { \ + if (unlikely(drm_debug & DRM_UT_CORE)) \ + drm_ut_debug_printk(fmt, ##args); \ +} while (0) #define DRM_DEBUG_DRIVER(fmt, args...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_DRIVER)) \ - drm_ut_debug_printk(__func__, fmt, ##args); \ - } while (0) +do { \ + if (unlikely(drm_debug & DRM_UT_DRIVER)) \ + drm_ut_debug_printk(fmt, ##args); \ +} while (0) #define DRM_DEBUG_KMS(fmt, args...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_KMS)) \ - drm_ut_debug_printk(__func__, fmt, ##args); \ - } while (0) +do { \ + if (unlikely(drm_debug & DRM_UT_KMS)) \ + drm_ut_debug_printk(fmt, ##args); \ +} while (0) #define DRM_DEBUG_PRIME(fmt, args...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_PRIME)) \ - drm_ut_debug_printk(__func__, fmt, ##args); \ - } while (0) +do { \ + if (unlikely(drm_debug & DRM_UT_PRIME)) \ + drm_ut_debug_printk(fmt, ##args); \ +} while (0)/*@}*/ _______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Joe Perches
Using %pf,
__builtin_return_address(0)instead ofy "%s",__func__reduces code size by eliminating a function argument.
[]
Quoted 4 lines
I have an earlier version from you of this patch already, and it's in linux-next. And this patch here lacks the changelog indicating what changed exactly. Can you please rebase on top of linux-next and improve the commit message?
I was working on another tree and didn't
see the first patch. Ignore this please.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel