mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Sean Chang <seanwascoding@gmail.com>
Cc: Chuck Lever <cel@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Chuck Lever <chuck.lever@oracle.com>,
	David Laight <david.laight.linux@gmail.com>,
	Anna Schumaker <anna@kernel.org>,
	netdev@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sunrpc: simplify dprintk() macros and cleanup redundant debug guards
Date: Wed, 18 Mar 2026 18:40:50 +0200	[thread overview]
Message-ID: <abrVkvbmhQsAA0rZ@ashevche-desk.local> (raw)
In-Reply-To: <CAAb=EJXA+SVPWLcWu1WRr-8A5Vk0k4za09+ROFqYX2eceH65XA@mail.gmail.com>

On Thu, Mar 19, 2026 at 12:21:41AM +0800, Sean Chang wrote:
> On Tue, Mar 17, 2026 at 10:20 PM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > > > > > Does this patch fixes also 202603110038.P6d14oxa-lkp@intel.com?
> > > > >
> > > > > Regarding the LKP report:
> > > > > I have reproduced the Sparse warning (void vs int mismatch) locally.
> > > > > To resolve this, I'll use the do-while(0) form in v3 to ensure the macro
> > > > > always evaluates to void:
> > > > > -# define dfprintk(fac, ...)            no_printk(__VA_ARGS__)
> > > > > -# define dfprintk_rcu(fac, ...)        no_printk(__VA_ARGS__)
> > > > > +# define dfprintk(fac, ...)            do { no_printk(__VA_ARGS__); } while (0)
> > > > > +# define dfprintk_rcu(fac, ...)        do { no_printk(__VA_ARGS__); } while (0)
> > > >
> > > > Wouldn't be better to drop ({}) in nfs_error*() macros?
> > >
> > > I understand that the ({}) wrapper might look redundant at first
> > > glance. However,
> > > even if I remove it, the return type remains an issue because no_printk() (which
> > > dprintk() expands to) already contains its own ({}) statement expression.
> > >
> > > To resolve this without refactoring errorf(), which hasn't been
> > > touched in years,
> > > I believe modifying dfprintk() is the better path.
> > >
> > > One alternative is to explicitly force the return type to void like this:
> > > ({ dprintk(fmt "\n", ##__VA_ARGS__); (void)0; })
> > >
> > > While this ensures the return type remains void (consistent with the
> > > behavior before
> > > dprintk() was redefined), it is admittedly clunky. We could wrap
> > > (void)0 in a macro like
> > > #define nothing_to_do ((void)0), but that adds unnecessary complexity.
> > >
> > > Therefore, I still prefer Option 1, as it restores the original
> > > behavior from before the
> > > recent commits and maintains the cleanest code structure for this subsystem.
> > > What do you think?
> >
> > Personally I found the ({}) in nfs_error*() redundant and the point of those
> > functions not being touched in years doesn't work for internal APIs. Do you
> > know the reason why it wasn't touched? Perhaps there was nothing to do simply
> > with that until dprintk() issue reveals some (legacy?) stuff to improve.
> >
> > I would not go with (void)0 approach, but I also think that dropping unneeded
> > (if confirmed) expression wrapping is a good thing to do.

> Thanks for your comment, how about removing the ({}) and ternary operator to
> prevent sparse throw incompatible types. And use the do{} while(0) to prevent
> dangling-else problem.

LGTM.

> #define nfs_errorf(fc, fmt, ...) do { \
>     if ((fc)->log.log) \
>         errorf(fc, fmt, ## __VA_ARGS__); \
>     else \
>         dprintk(fmt "\n", ## __VA_ARGS__); \
> } while (0)

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-03-18 16:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 14:07 Sean Chang
2026-03-11 21:47 ` Andy Shevchenko
2026-03-12 13:19 ` Chuck Lever
2026-03-12 15:54   ` Sean Chang
2026-03-12 16:14     ` Andy Shevchenko
2026-03-12 17:52     ` Chuck Lever
2026-03-17 13:04       ` Sean Chang
2026-03-17 14:20         ` Andy Shevchenko
2026-03-18 16:21           ` Sean Chang
2026-03-18 16:40             ` Andy Shevchenko [this message]

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=abrVkvbmhQsAA0rZ@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andrew@lunn.ch \
    --cc=anna@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=seanwascoding@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®