[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1415088226.24560.1.camel@perches.com>
Date: Tue, 04 Nov 2014 00:03:46 -0800
From: Joe Perches <joe@...ches.com>
To: David Airlie <airlied@...ux.ie>
Cc: dri-devel <dri-devel@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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
Signed-off-by: Joe Perches <joe@...ches.com>
---
drivers/gpu/drm/drm_drv.c | 10 ++++++----
include/drm/drmP.h | 45 ++++++++++++++++++++++-----------------------
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index bc3da32..22f76a2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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);
}
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 53ed876..02aaa1a 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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)
/*@}*/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists