diff mbox

[v3,1/2] Return a value from printk_ratelimited

Message ID a4437b89bc5684ea1d6f978039bd255d1f5b26f9.1411796033.git.osandov@osandov.com (mailing list archive)
State New, archived
Headers show

Commit Message

Omar Sandoval Sept. 27, 2014, 5:36 a.m. UTC
printk returns an integer; there's no reason for printk_ratelimited to swallow
it.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 include/linux/printk.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Joe Perches Sept. 27, 2014, 5:48 a.m. UTC | #1
On Fri, 2014-09-26 at 22:36 -0700, Omar Sandoval wrote:
> printk returns an integer; there's no reason for printk_ratelimited to swallow
> it.
> 
> Signed-off-by: Omar Sandoval <osandov@osandov.com>
> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---

I'd prefer to keep it the way it is actually.

I've submitted several patches to convert the int return
to void for printk derived functions recently.


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Omar Sandoval Sept. 27, 2014, 7:45 a.m. UTC | #2
On Fri, Sep 26, 2014 at 10:48:11PM -0700, Joe Perches wrote:
> I'd prefer to keep it the way it is actually.
> 
> I've submitted several patches to convert the int return
> to void for printk derived functions recently.

Alright, it doesn't seem like anyone feels strongly for keeping the return
values, so I'll go ahead and submit a v4 that doesn't modify printk_ratelimited
and doesn't return anything from the printk functions in rcustring.h unless
there are any objections.
diff mbox

Patch

diff --git a/include/linux/printk.h b/include/linux/printk.h
index d78125f..89bb7ab 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -343,12 +343,14 @@  extern asmlinkage void dump_stack(void) __cold;
 #ifdef CONFIG_PRINTK
 #define printk_ratelimited(fmt, ...)					\
 ({									\
+	int __ret_printk_ratelimited = 0;				\
 	static DEFINE_RATELIMIT_STATE(_rs,				\
 				      DEFAULT_RATELIMIT_INTERVAL,	\
 				      DEFAULT_RATELIMIT_BURST);		\
 									\
 	if (__ratelimit(&_rs))						\
-		printk(fmt, ##__VA_ARGS__);				\
+		__ret_printk_ratelimited = printk(fmt, ##__VA_ARGS__);	\
+	__ret_printk_ratelimited;					\
 })
 #else
 #define printk_ratelimited(fmt, ...)					\