* [PATCH] drm: change drm_err return type to void
@ 2014-09-22 16:30 Joe Perches
2014-09-23 13:00 ` Jani Nikula
0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2014-09-22 16:30 UTC (permalink / raw)
To: David Airlie; +Cc: dri-devel, LKML
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.
Signed-off-by: Joe Perches <joe@perches.com>
---
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(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 6a11902..8889f8e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 5c60d38..2163ccb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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 */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: change drm_err return type to void
2014-09-22 16:30 [PATCH] drm: change drm_err return type to void Joe Perches
@ 2014-09-23 13:00 ` Jani Nikula
2014-09-23 13:52 ` Daniel Vetter
0 siblings, 1 reply; 6+ messages in thread
From: Jani Nikula @ 2014-09-23 13:00 UTC (permalink / raw)
To: Joe Perches, David Airlie; +Cc: LKML, dri-devel
On Mon, 22 Sep 2014, Joe Perches <joe@perches.com> wrote:
> 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.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 6a11902..8889f8e 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -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);
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 5c60d38..2163ccb 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -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
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: change drm_err return type to void
2014-09-23 13:00 ` Jani Nikula
@ 2014-09-23 13:52 ` Daniel Vetter
2014-10-12 5:08 ` [PATCH] drm: drm_err: Remove unnecessary __func__ argument Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2014-09-23 13:52 UTC (permalink / raw)
To: Jani Nikula; +Cc: Joe Perches, David Airlie, LKML, dri-devel
On Tue, Sep 23, 2014 at 04:00:44PM +0300, Jani Nikula wrote:
> On Mon, 22 Sep 2014, Joe Perches <joe@perches.com> wrote:
> > 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.
> >
> > Signed-off-by: Joe Perches <joe@perches.com>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Merged into my topic/core-stuff branch to make sure it won't get lost.
-Daniel
>
>
> > ---
> > 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(-)
> >
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index 6a11902..8889f8e 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -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);
> >
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 5c60d38..2163ccb 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -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
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] drm: drm_err: Remove unnecessary __func__ argument
2014-09-23 13:52 ` Daniel Vetter
@ 2014-10-12 5:08 ` Joe Perches
2014-10-13 15:46 ` David Herrmann
0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2014-10-12 5:08 UTC (permalink / raw)
To: Daniel Vetter; +Cc: Jani Nikula, David Airlie, LKML, dri-devel
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
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/gpu/drm/drm_drv.c | 5 +++--
include/drm/drmP.h | 8 ++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 9f0e1b9..e9263d9 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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);
}
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index ca374ac..5e9ff52 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -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, ...) \
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: drm_err: Remove unnecessary __func__ argument
2014-10-12 5:08 ` [PATCH] drm: drm_err: Remove unnecessary __func__ argument Joe Perches
@ 2014-10-13 15:46 ` David Herrmann
2014-10-13 15:54 ` Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: David Herrmann @ 2014-10-13 15:46 UTC (permalink / raw)
To: Joe Perches, Dave Airlie; +Cc: Daniel Vetter, dri-devel, LKML
Hi
On Sun, Oct 12, 2014 at 7:08 AM, Joe Perches <joe@perches.com> wrote:
> 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
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
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/gpu/drm/drm_drv.c | 5 +++--
> include/drm/drmP.h | 8 ++++----
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 9f0e1b9..e9263d9 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -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);
> }
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index ca374ac..5e9ff52 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -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
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm: drm_err: Remove unnecessary __func__ argument
2014-10-13 15:46 ` David Herrmann
@ 2014-10-13 15:54 ` Joe Perches
0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2014-10-13 15:54 UTC (permalink / raw)
To: David Herrmann; +Cc: Dave Airlie, Daniel Vetter, dri-devel, LKML
On Mon, 2014-10-13 at 17:46 +0200, David Herrmann wrote:
> Hi
>
> On Sun, Oct 12, 2014 at 7:08 AM, Joe Perches <joe@perches.com> wrote:
> > 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
>
> You 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.
> 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.
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-13 15:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22 16:30 [PATCH] drm: change drm_err return type to void Joe Perches
2014-09-23 13:00 ` Jani Nikula
2014-09-23 13:52 ` Daniel Vetter
2014-10-12 5:08 ` [PATCH] drm: drm_err: Remove unnecessary __func__ argument Joe Perches
2014-10-13 15:46 ` David Herrmann
2014-10-13 15:54 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).