Re: [PATCH v2] rcu: Don't return a value from rcu_assign_pointer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2019-05-27 at 10:49 -0700, Paul E. McKenney wrote:
> On Mon, May 27, 2019 at 10:21:22AM -0700, Joe Perches wrote:
> > On Mon, 2019-05-27 at 09:10 -0700, Paul E. McKenney wrote:
> > > On Mon, May 27, 2019 at 10:49:57AM +0200, Andrea Parri wrote:
> > > > Quoting Paul [1]:
> > > > 
> > > >   "Given that a quick (and perhaps error-prone) search of the uses
> > > >    of rcu_assign_pointer() in v5.1 didn't find a single use of the
> > > >    return value, let's please instead change the documentation and
> > > >    implementation to eliminate the return value."
> > > > 
> > > > [1] https://lkml.kernel.org/r/20190523135013.GL28207@xxxxxxxxxxxxx
> > > 
> > > Queued, thank you!
> > > 
> > > Adding the checkpatch maintainers on CC as well.  The "do { } while
> > > (0)" prevents the return value from being used, by design.  Given the
> > > checkpatch complaint, is there some better way to achieve this?
> > 
> > Not sure what the checkpatch complaint is here.
> 
> Checkpatch seems to want at least two statements in each
> "do { } while (0)" macro definition:
> 
> WARNING: Single statement macros should not use a do {} while (0) loop
> 
> > Reading the link above, there seems to be a compiler warning.
> 
> The compiler warning is a theoretical issue that is being fixed by this
> patch, and the patch is giving the checkpatch warning.
> 
> > Perhaps a statement expression macro with no return value?
> > 
> > #define rcu_assign_pointer(p, v)	({ (p) = (v); ; })
> 
> This is at best an acquired taste for me...

Another ugly possibility could be:

#define rcu_assign_pointer(p, v) do {if (1) (p) = (v); } while (0)

Possibly the best option would be to ignore checkpatch here
and just add a comment above the use.






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux