Re: [PATCH v3] LoongArch/percpu: Simplify _percpu_read() and _percpu_write()

From: Xi Ruoyao
Date: Thu Sep 05 2024 - 07:58:34 EST


On Thu, 2024-09-05 at 19:47 +0800, Huacai Chen wrote:
> > +#define _percpu_write(size, _pcp, _val)                                        \
> > +do {                                                                   \
> > +       unsigned long __pcp_val = __pcpu_cast_##size(_val);             \
> > +                                                                       \
> > +       if (0) {                                                        \
> > +               typeof(_pcp) pto_tmp__;                                 \
> > +               pto_tmp__ = (_val);                                     \
> > +               (void)pto_tmp__;                                        \
> > +       }                                                               \
> Emmm, in V2 I just confirm that whether it is worth to use macro
> instead of inline functions, I think we don't really need such a
> checking here. :)

It's still (slighly) better (just from aesthetics view) to use inline
function instead of macro. Is it possible to clear the header
dependency and break the circle so we can still use __percpu in arch
percpu.h instead?

(Simply removing __percpu from the function parameter list causes many
warnings with make C=1.)

--
Xi Ruoyao <xry111@xxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University