public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] device: Change dev_<level> logging functions to return void
@ 2014-12-25 23:07 Joe Perches
  2015-01-18  0:56 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2014-12-25 23:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: LKML

No caller or macro uses the return value so make all
the functions return void.

Compiled x86 allyesconfig and defconfig w/o CONFIG_PRINTK

Signed-off-by: Joe Perches <joe@perches.com>
---
This change is associated to a desire to eventually
change printk to return void.

 drivers/base/core.c    | 29 +++++++++---------------
 include/linux/device.h | 60 ++++++++++++++++++++++++--------------------------
 2 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 97e2baf..07304a3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
 }
 EXPORT_SYMBOL(dev_printk_emit);
 
-static int __dev_printk(const char *level, const struct device *dev,
+static void __dev_printk(const char *level, const struct device *dev,
 			struct va_format *vaf)
 {
-	if (!dev)
-		return printk("%s(NULL device *): %pV", level, vaf);
-
-	return dev_printk_emit(level[1] - '0', dev,
-			       "%s %s: %pV",
-			       dev_driver_string(dev), dev_name(dev), vaf);
+	if (dev)
+		dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
+				dev_driver_string(dev), dev_name(dev), vaf);
+	else
+		printk("%s(NULL device *): %pV", level, vaf);
 }
 
-int dev_printk(const char *level, const struct device *dev,
-	       const char *fmt, ...)
+void dev_printk(const char *level, const struct device *dev,
+		const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
-	int r;
 
 	va_start(args, fmt);
 
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	r = __dev_printk(level, dev, &vaf);
+	__dev_printk(level, dev, &vaf);
 
 	va_end(args);
-
-	return r;
 }
 EXPORT_SYMBOL(dev_printk);
 
 #define define_dev_printk_level(func, kern_level)		\
-int func(const struct device *dev, const char *fmt, ...)	\
+void func(const struct device *dev, const char *fmt, ...)	\
 {								\
 	struct va_format vaf;					\
 	va_list args;						\
-	int r;							\
 								\
 	va_start(args, fmt);					\
 								\
 	vaf.fmt = fmt;						\
 	vaf.va = &args;						\
 								\
-	r = __dev_printk(kern_level, dev, &vaf);		\
+	__dev_printk(kern_level, dev, &vaf);			\
 								\
 	va_end(args);						\
-								\
-	return r;						\
 }								\
 EXPORT_SYMBOL(func);
 
diff --git a/include/linux/device.h b/include/linux/device.h
index fb50673..3c17713 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1038,22 +1038,22 @@ extern __printf(3, 4)
 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
 
 extern __printf(3, 4)
-int dev_printk(const char *level, const struct device *dev,
-	       const char *fmt, ...);
+void dev_printk(const char *level, const struct device *dev,
+		const char *fmt, ...);
 extern __printf(2, 3)
-int dev_emerg(const struct device *dev, const char *fmt, ...);
+void dev_emerg(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int dev_alert(const struct device *dev, const char *fmt, ...);
+void dev_alert(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int dev_crit(const struct device *dev, const char *fmt, ...);
+void dev_crit(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int dev_err(const struct device *dev, const char *fmt, ...);
+void dev_err(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int dev_warn(const struct device *dev, const char *fmt, ...);
+void dev_warn(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int dev_notice(const struct device *dev, const char *fmt, ...);
+void dev_notice(const struct device *dev, const char *fmt, ...);
 extern __printf(2, 3)
-int _dev_info(const struct device *dev, const char *fmt, ...);
+void _dev_info(const struct device *dev, const char *fmt, ...);
 
 #else
 
@@ -1065,35 +1065,35 @@ static inline __printf(3, 4)
 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
 { return 0; }
 
-static inline int __dev_printk(const char *level, const struct device *dev,
-			       struct va_format *vaf)
-{ return 0; }
+static inline void __dev_printk(const char *level, const struct device *dev,
+				struct va_format *vaf)
+{}
 static inline __printf(3, 4)
-int dev_printk(const char *level, const struct device *dev,
-	       const char *fmt, ...)
-{ return 0; }
+void dev_printk(const char *level, const struct device *dev,
+		const char *fmt, ...)
+{}
 
 static inline __printf(2, 3)
-int dev_emerg(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_emerg(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int dev_crit(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_crit(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int dev_alert(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_alert(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int dev_err(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_err(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int dev_warn(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_warn(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int dev_notice(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void dev_notice(const struct device *dev, const char *fmt, ...)
+{}
 static inline __printf(2, 3)
-int _dev_info(const struct device *dev, const char *fmt, ...)
-{ return 0; }
+void _dev_info(const struct device *dev, const char *fmt, ...)
+{}
 
 #endif
 
@@ -1119,7 +1119,6 @@ do {						     \
 ({								\
 	if (0)							\
 		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
-	0;							\
 })
 #endif
 
@@ -1215,7 +1214,6 @@ do {									\
 ({								\
 	if (0)							\
 		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
-	0;							\
 })
 #endif
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] device: Change dev_<level> logging functions to return void
  2014-12-25 23:07 [PATCH] device: Change dev_<level> logging functions to return void Joe Perches
@ 2015-01-18  0:56 ` Joe Perches
  2015-01-18  1:07   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2015-01-18  0:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: LKML

On Thu, 2014-12-25 at 15:07 -0800, Joe Perches wrote:
> No caller or macro uses the return value so make all
> the functions return void.

Ping?

> Compiled x86 allyesconfig and defconfig w/o CONFIG_PRINTK
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> This change is associated to a desire to eventually
> change printk to return void.
> 
>  drivers/base/core.c    | 29 +++++++++---------------
>  include/linux/device.h | 60 ++++++++++++++++++++++++--------------------------
>  2 files changed, 40 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 97e2baf..07304a3 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
>  }
>  EXPORT_SYMBOL(dev_printk_emit);
>  
> -static int __dev_printk(const char *level, const struct device *dev,
> +static void __dev_printk(const char *level, const struct device *dev,
>  			struct va_format *vaf)
>  {
> -	if (!dev)
> -		return printk("%s(NULL device *): %pV", level, vaf);
> -
> -	return dev_printk_emit(level[1] - '0', dev,
> -			       "%s %s: %pV",
> -			       dev_driver_string(dev), dev_name(dev), vaf);
> +	if (dev)
> +		dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
> +				dev_driver_string(dev), dev_name(dev), vaf);
> +	else
> +		printk("%s(NULL device *): %pV", level, vaf);
>  }
>  
> -int dev_printk(const char *level, const struct device *dev,
> -	       const char *fmt, ...)
> +void dev_printk(const char *level, const struct device *dev,
> +		const char *fmt, ...)
>  {
>  	struct va_format vaf;
>  	va_list args;
> -	int r;
>  
>  	va_start(args, fmt);
>  
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  
> -	r = __dev_printk(level, dev, &vaf);
> +	__dev_printk(level, dev, &vaf);
>  
>  	va_end(args);
> -
> -	return r;
>  }
>  EXPORT_SYMBOL(dev_printk);
>  
>  #define define_dev_printk_level(func, kern_level)		\
> -int func(const struct device *dev, const char *fmt, ...)	\
> +void func(const struct device *dev, const char *fmt, ...)	\
>  {								\
>  	struct va_format vaf;					\
>  	va_list args;						\
> -	int r;							\
>  								\
>  	va_start(args, fmt);					\
>  								\
>  	vaf.fmt = fmt;						\
>  	vaf.va = &args;						\
>  								\
> -	r = __dev_printk(kern_level, dev, &vaf);		\
> +	__dev_printk(kern_level, dev, &vaf);			\
>  								\
>  	va_end(args);						\
> -								\
> -	return r;						\
>  }								\
>  EXPORT_SYMBOL(func);
>  
> diff --git a/include/linux/device.h b/include/linux/device.h
> index fb50673..3c17713 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -1038,22 +1038,22 @@ extern __printf(3, 4)
>  int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
>  
>  extern __printf(3, 4)
> -int dev_printk(const char *level, const struct device *dev,
> -	       const char *fmt, ...);
> +void dev_printk(const char *level, const struct device *dev,
> +		const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_emerg(const struct device *dev, const char *fmt, ...);
> +void dev_emerg(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_alert(const struct device *dev, const char *fmt, ...);
> +void dev_alert(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_crit(const struct device *dev, const char *fmt, ...);
> +void dev_crit(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_err(const struct device *dev, const char *fmt, ...);
> +void dev_err(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_warn(const struct device *dev, const char *fmt, ...);
> +void dev_warn(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int dev_notice(const struct device *dev, const char *fmt, ...);
> +void dev_notice(const struct device *dev, const char *fmt, ...);
>  extern __printf(2, 3)
> -int _dev_info(const struct device *dev, const char *fmt, ...);
> +void _dev_info(const struct device *dev, const char *fmt, ...);
>  
>  #else
>  
> @@ -1065,35 +1065,35 @@ static inline __printf(3, 4)
>  int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
>  { return 0; }
>  
> -static inline int __dev_printk(const char *level, const struct device *dev,
> -			       struct va_format *vaf)
> -{ return 0; }
> +static inline void __dev_printk(const char *level, const struct device *dev,
> +				struct va_format *vaf)
> +{}
>  static inline __printf(3, 4)
> -int dev_printk(const char *level, const struct device *dev,
> -	       const char *fmt, ...)
> -{ return 0; }
> +void dev_printk(const char *level, const struct device *dev,
> +		const char *fmt, ...)
> +{}
>  
>  static inline __printf(2, 3)
> -int dev_emerg(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_emerg(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int dev_crit(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_crit(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int dev_alert(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_alert(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int dev_err(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_err(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int dev_warn(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_warn(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int dev_notice(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void dev_notice(const struct device *dev, const char *fmt, ...)
> +{}
>  static inline __printf(2, 3)
> -int _dev_info(const struct device *dev, const char *fmt, ...)
> -{ return 0; }
> +void _dev_info(const struct device *dev, const char *fmt, ...)
> +{}
>  
>  #endif
>  
> @@ -1119,7 +1119,6 @@ do {						     \
>  ({								\
>  	if (0)							\
>  		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
> -	0;							\
>  })
>  #endif
>  
> @@ -1215,7 +1214,6 @@ do {									\
>  ({								\
>  	if (0)							\
>  		dev_printk(KERN_DEBUG, dev, format, ##arg);	\
> -	0;							\
>  })
>  #endif
>  
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] device: Change dev_<level> logging functions to return void
  2015-01-18  0:56 ` Joe Perches
@ 2015-01-18  1:07   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2015-01-18  1:07 UTC (permalink / raw)
  To: Joe Perches; +Cc: LKML

On Sat, Jan 17, 2015 at 04:56:20PM -0800, Joe Perches wrote:
> On Thu, 2014-12-25 at 15:07 -0800, Joe Perches wrote:
> > No caller or macro uses the return value so make all
> > the functions return void.
> 
> Ping?

It's in my queue, just starting to dig out from under it, give me a few
more days please, it's not lost.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-18  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-25 23:07 [PATCH] device: Change dev_<level> logging functions to return void Joe Perches
2015-01-18  0:56 ` Joe Perches
2015-01-18  1:07   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox