diff mbox series

[net-next] Simplify net_dbg_ratelimited() dummy

Message ID 5d75ce122b5cbfe62b018a7719960e34cfcbb1f2.1709128975.git.geert+renesas@glider.be
State New
Headers show
Series [net-next] Simplify net_dbg_ratelimited() dummy | expand

Commit Message

Geert Uytterhoeven Feb. 28, 2024, 2:05 p.m. UTC
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 <geert+renesas@glider.be>
---
 include/linux/net.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Alex Elder Feb. 28, 2024, 2:28 p.m. UTC | #1
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 <geert+renesas@glider.be>

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 <elder@linaro.org>



> ---
>   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)			\
Andy Shevchenko Feb. 28, 2024, 5:42 p.m. UTC | #2
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 <andriy.shevchenko@linux.intel.com>
Chris Down March 1, 2024, 12:40 a.m. UTC | #3
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 <geert+renesas@glider.be>

In the context of the larger printk index changes:

Acked-by: Chris Down <chris@chrisdown.name>

>---
> 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
>
diff mbox series

Patch

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)			\