All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Sean Chang <seanwascoding@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Chuck Lever <chuck.lever@oracle.com>,
	David Laight <david.laight.linux@gmail.com>,
	nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
	trond.myklebust@hammerspace.com, anna@kernel.org,
	netdev@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v6 1/2] sunrpc: simplify dprintk macros and cleanup redundant debug guards
Date: Mon, 2 Mar 2026 14:27:27 +0100	[thread overview]
Message-ID: <aaWQPw-My_eo1myI@black.igk.intel.com> (raw)
In-Reply-To: <20260301161709.1365975-2-seanwascoding@gmail.com>

On Mon, Mar 02, 2026 at 12:17:08AM +0800, Sean Chang wrote:
> When CONFIG_SUNRPC_DEBUG is disabled, the dfprintk() macros currently
> expand to empty do-while loops. This causes variables used solely
> within these calls to appear unused, triggering -Wunused-variable
> warnings.
> 
> Following David Laight's suggestion, simplify the macro definitions by
> removing the unnecessary 'fmt' argument and using no_printk(__VA_ARGS__)
> directly. This ensures the compiler performs type checking and "sees"
> the variables, silencing the warnings without emitting any code.
> 
> Verification with .lst files under -O2 confirms that the compiler
> successfully performs "dead code elimination". Even when variables
> (like char buf[] in nfsfh.c) or static helper functions (like
> nlmdbg_cookie2a in svclock.c) are declared without #ifdef, they are
> completely optimized out (no stack allocation, no symbol references in
> the final executable) as they are only referenced within no_printk().
> 
> This allows for significant cleanup:
> - Remove RPC_IFDEBUG() and associated #if blocks in fs/nfsd/nfsfh.c
>   and net/sunrpc/xprtrdma/svc_rdma_transport.c.
> - Remove the #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) guard around
>   nlmdbg_cookie2a in fs/lockd/svclock.c.
> - Consolidate the dprintk definition to be more idiomatic.
> 
> This fixes the build errors reported by the kernel test robot while
> improving code maintainability.

If you feel something has to be done against nfsd-next, please rebase and send
as a standalone patch.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-03-02 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 16:17 [PATCH v6 0/2] Fix compiler warnings/errors in SUNRPC and MACB Sean Chang
2026-03-01 16:17 ` [PATCH v6 1/2] sunrpc: simplify dprintk macros and cleanup redundant debug guards Sean Chang
2026-03-02 13:27   ` Andy Shevchenko [this message]
2026-03-01 16:17 ` [PATCH v6 2/2] net: macb: use ethtool_sprintf to fill ethtool stats strings Sean Chang
2026-03-01 17:39 ` [PATCH v6 0/2] Fix compiler warnings/errors in SUNRPC and MACB Andrew Lunn
2026-03-02 13:26   ` Andy Shevchenko
2026-03-02 16:28     ` Sean Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaWQPw-My_eo1myI@black.igk.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andrew@lunn.ch \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=seanwascoding@gmail.com \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.