2024-02-28 14:06:11

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

There is no need to wrap calls to the no_printk() helper inside an
always-false check, as no_printk() already does that internally.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
include/linux/net.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index c9b4a63791a45948..15df6d5f27a7badc 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -299,10 +299,7 @@ do { \
net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
#else
#define net_dbg_ratelimited(fmt, ...) \
- do { \
- if (0) \
- no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
- } while (0)
+ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif

#define net_get_random_once(buf, nbytes) \
--
2.34.1



2024-02-28 14:29:11

by Alex Elder

[permalink] [raw]
Subject: Re: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

On 2/28/24 8:05 AM, Geert Uytterhoeven wrote:
> There is no need to wrap calls to the no_printk() helper inside an
> always-false check, as no_printk() already does that internally.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

This looks fine. The only difference I see is that no_printk()
returns a value (always 0), while the old way does not. You
could cast the result to void to avoid that.

Otherwise:

Reviewed-by: Alex Elder <[email protected]>



> ---
> include/linux/net.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/include/linux/net.h b/include/linux/net.h
> index c9b4a63791a45948..15df6d5f27a7badc 100644
> --- a/include/linux/net.h
> +++ b/include/linux/net.h
> @@ -299,10 +299,7 @@ do { \
> net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
> #else
> #define net_dbg_ratelimited(fmt, ...) \
> - do { \
> - if (0) \
> - no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
> - } while (0)
> + no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> #endif
>
> #define net_get_random_once(buf, nbytes) \


2024-02-28 17:43:02

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

On Wed, Feb 28, 2024 at 03:05:02PM +0100, Geert Uytterhoeven wrote:
> There is no need to wrap calls to the no_printk() helper inside an
> always-false check, as no_printk() already does that internally.

This also makes sense.
Reviewed-by: Andy Shevchenko <[email protected]>

--
With Best Regards,
Andy Shevchenko



2024-02-28 19:31:48

by Jiri Pirko

[permalink] [raw]
Subject: Re: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

Wed, Feb 28, 2024 at 03:05:29PM CET, [email protected] wrote:
>There is no need to wrap calls to the no_printk() helper inside an
>always-false check, as no_printk() already does that internally.
>
>Signed-off-by: Geert Uytterhoeven <[email protected]>

Reviewed-by: Jiri Pirko <[email protected]>

2024-03-01 00:40:23

by Chris Down

[permalink] [raw]
Subject: Re: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

Geert Uytterhoeven writes:
>There is no need to wrap calls to the no_printk() helper inside an
>always-false check, as no_printk() already does that internally.
>
>Signed-off-by: Geert Uytterhoeven <[email protected]>

In the context of the larger printk index changes:

Acked-by: Chris Down <[email protected]>

>---
> include/linux/net.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
>diff --git a/include/linux/net.h b/include/linux/net.h
>index c9b4a63791a45948..15df6d5f27a7badc 100644
>--- a/include/linux/net.h
>+++ b/include/linux/net.h
>@@ -299,10 +299,7 @@ do { \
> net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
> #else
> #define net_dbg_ratelimited(fmt, ...) \
>- do { \
>- if (0) \
>- no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
>- } while (0)
>+ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> #endif
>
> #define net_get_random_once(buf, nbytes) \
>--
>2.34.1
>

2024-03-01 08:52:18

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next] Simplify net_dbg_ratelimited() dummy

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <[email protected]>:

On Wed, 28 Feb 2024 15:05:29 +0100 you wrote:
> There is no need to wrap calls to the no_printk() helper inside an
> always-false check, as no_printk() already does that internally.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> include/linux/net.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)

Here is the summary with links:
- [net-next] Simplify net_dbg_ratelimited() dummy
https://git.kernel.org/netdev/net-next/c/f29f9199c2d2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html