* [PATCH] printk: simplify no_printk()
@ 2017-09-17 15:01 Masahiro Yamada
2017-09-17 18:31 ` Joe Perches
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Masahiro Yamada @ 2017-09-17 15:01 UTC (permalink / raw)
To: Andrew Morton
Cc: Ingo Molnar, Masahiro Yamada, Sergey Senozhatsky, Steven Rostedt,
Petr Mladek, linux-kernel
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: simplify no_printk()
2017-09-17 15:01 [PATCH] printk: simplify no_printk() Masahiro Yamada
@ 2017-09-17 18:31 ` Joe Perches
2017-09-26 6:43 ` Sergey Senozhatsky
2017-10-02 14:56 ` Petr Mladek
2 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2017-09-17 18:31 UTC (permalink / raw)
To: Masahiro Yamada, Andrew Morton
Cc: Ingo Molnar, Sergey Senozhatsky, Steven Rostedt, Petr Mladek,
linux-kernel
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; \
> })
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: simplify no_printk()
2017-09-17 15:01 [PATCH] printk: simplify no_printk() Masahiro Yamada
2017-09-17 18:31 ` Joe Perches
@ 2017-09-26 6:43 ` Sergey Senozhatsky
2017-10-02 14:56 ` Petr Mladek
2 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2017-09-26 6:43 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Ingo Molnar, Sergey Senozhatsky, Steven Rostedt,
Petr Mladek, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: simplify no_printk()
2017-09-17 15:01 [PATCH] printk: simplify no_printk() Masahiro Yamada
2017-09-17 18:31 ` Joe Perches
2017-09-26 6:43 ` Sergey Senozhatsky
@ 2017-10-02 14:56 ` Petr Mladek
2017-10-19 10:48 ` Masahiro Yamada
2 siblings, 1 reply; 6+ messages in thread
From: Petr Mladek @ 2017-10-02 14:56 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Ingo Molnar, Sergey Senozhatsky, Steven Rostedt,
linux-kernel
On Mon 2017-09-18 00:01:44, 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 fine to me. The return value is slightly more visible now ;-)
Reviewed-by: Petr Mladek <pmladek@suse.com>
JFYI, I have pushed it into for-4.15 branch.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: simplify no_printk()
2017-10-02 14:56 ` Petr Mladek
@ 2017-10-19 10:48 ` Masahiro Yamada
2017-10-19 13:38 ` Petr Mladek
0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-19 10:48 UTC (permalink / raw)
To: Petr Mladek
Cc: Andrew Morton, Ingo Molnar, Sergey Senozhatsky, Steven Rostedt,
Linux Kernel Mailing List
Hi Petr,
2017-10-02 23:56 GMT+09:00 Petr Mladek <pmladek@suse.com>:
> On Mon 2017-09-18 00:01:44, 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 fine to me. The return value is slightly more visible now ;-)
>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
>
> JFYI, I have pushed it into for-4.15 branch.
>
> Best Regards,
> Petr
A minor problem.
I think "Reviewed-by: " is missing before Sergey.
I am not sure if this is too late, or not...
commit 38a8c55325f5d4f261fde8b1bebfa2e9daf7c3e1
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Mon Sep 18 00:01:44 2017 +0900
printk: simplify no_printk()
Commit 069f0cd00df0 ("printk: Make the printk*once() variants return
a value") surrounded the macro implementation with ({ ... }).
Now, the inner do { ... } while (0); is redundant.
Link: http://lkml.kernel.org/r/1505660504-11059-1-git-send-email-yamada.masahiro@socionext.com
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: simplify no_printk()
2017-10-19 10:48 ` Masahiro Yamada
@ 2017-10-19 13:38 ` Petr Mladek
0 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2017-10-19 13:38 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, Ingo Molnar, Sergey Senozhatsky, Steven Rostedt,
Linux Kernel Mailing List
On Thu 2017-10-19 19:48:15, Masahiro Yamada wrote:
> Hi Petr,
>
> 2017-10-02 23:56 GMT+09:00 Petr Mladek <pmladek@suse.com>:
> > On Mon 2017-09-18 00:01:44, 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 fine to me. The return value is slightly more visible now ;-)
> >
> > Reviewed-by: Petr Mladek <pmladek@suse.com>
> >
> > JFYI, I have pushed it into for-4.15 branch.
> >
> > Best Regards,
> > Petr
>
>
> A minor problem.
>
> I think "Reviewed-by: " is missing before Sergey.
Great catch! Thanks for double checking!
> I am not sure if this is too late, or not...
Just pushed a fix.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-19 13:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-17 15:01 [PATCH] printk: simplify no_printk() Masahiro Yamada
2017-09-17 18:31 ` Joe Perches
2017-09-26 6:43 ` Sergey Senozhatsky
2017-10-02 14:56 ` Petr Mladek
2017-10-19 10:48 ` Masahiro Yamada
2017-10-19 13:38 ` Petr Mladek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.