Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733472 > unrolled thread

[PATCH] printk: simplify no_printk()

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2017-09-17 17:10 +0200
Last post2017-09-26 08:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] printk: simplify no_printk() Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-09-17 17:10 +0200
    Re: [PATCH] printk: simplify no_printk() Joe Perches <joe@perches.com> - 2017-09-17 20:40 +0200
    Re: [PATCH] printk: simplify no_printk() Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-26 08:50 +0200

#1733472 — [PATCH] printk: simplify no_printk()

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-09-17 17:10 +0200
Subject[PATCH] printk: simplify no_printk()
Message-ID<uqJmN-19W-7@gated-at.bofh.it>
Commit 069f0cd00df0 ("printk: Make the printk*once() variants return
a value") surrounded the macro implementation with ({ ... }).

Now, the inner do { ... } while (0); is redundant.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/printk.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index e10f27468322..7911f7364346 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -131,10 +131,8 @@ struct va_format {
  */
 #define no_printk(fmt, ...)				\
 ({							\
-	do {						\
-		if (0)					\
-			printk(fmt, ##__VA_ARGS__);	\
-	} while (0);					\
+	if (0)						\
+		printk(fmt, ##__VA_ARGS__);		\
 	0;						\
 })
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1733520

FromJoe Perches <joe@perches.com>
Date2017-09-17 20:40 +0200
Message-ID<uqME1-39T-3@gated-at.bofh.it>
In reply to#1733472
On Mon, 2017-09-18 at 00:01 +0900, Masahiro Yamada wrote:
> Commit 069f0cd00df0 ("printk: Make the printk*once() variants return
> a value") surrounded the macro implementation with ({ ... }).
> 
> Now, the inner do { ... } while (0); is redundant.

thanks.

> diff --git a/include/linux/printk.h b/include/linux/printk.h
[]
> @@ -131,10 +131,8 @@ struct va_format {
>   */
>  #define no_printk(fmt, ...)				\
>  ({							\
> -	do {						\
> -		if (0)					\
> -			printk(fmt, ##__VA_ARGS__);	\
> -	} while (0);					\
> +	if (0)						\
> +		printk(fmt, ##__VA_ARGS__);		\
>  	0;						\
>  })

[toc] | [prev] | [next] | [standalone]


#1739555

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-09-26 08:50 +0200
Message-ID<utRQS-150-17@gated-at.bofh.it>
In reply to#1733472
On (09/18/17 00:01), Masahiro Yamada wrote:
> Commit 069f0cd00df0 ("printk: Make the printk*once() variants return
> a value") surrounded the macro implementation with ({ ... }).
> 
> Now, the inner do { ... } while (0); is redundant.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

looks ok to me. can't say that I see a huge difference, tho,
but, FWIW:

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web