[PATCH 6/7] coresight: Remove inlines from static function definitions

Leo Yan leo.yan at arm.com
Mon Mar 17 10:45:18 PDT 2025


On Mon, Mar 17, 2025 at 03:26:42PM +0000, James Clark wrote:
> On 14/03/2025 9:50 am, Leo Yan wrote:
> > On Tue, Feb 11, 2025 at 10:39:42AM +0000, James Clark wrote:
> > > 
> > > These are all static and in one compilation unit so the inline has no
> > > effect on the binary.
> > 
> > I read the doc coding-style.rst, the section "15) The inline disease",
> > my understanding is though the inline is not encouraged, I prefer we can
> > follow up the rule:
> > 
> >    A reasonable rule of thumb is to not put inline at functions that have more
> >    than 3 lines of code in them. An exception to this rule are the cases where
> >    a parameter is known to be a compile time constant, and as a result of this
> >    constantness you *know* the compiler will be able to optimize most of your
> >    function away at compile time. For a good example of this later case, see
> >    the kmalloc() inline function.
> > 
> 
> Isn't this advice about whether to make an inline function in a header file
> or do definition + declaration?

Maybe it is not about where defines inline functions.  It is about
how these inline functions are invoked.  E.g., in a single C file, a
inline function can be invoked in multiple places, and it is possible
the incline function can optimized by compiler case by case.

To be honest, I don't really understand how compiler works :)

[...]

> I think it can be useful, I've used it a little bit. Might as well make it
> easier to use for someone if it exists.

Sure.  This patch is fine for me.  I verified this patch with default
kernel configuration (-O2, -g), it does works as expected (no code and
data section's size change between with and without this patch).

Thanks,
Leo



More information about the linux-arm-kernel mailing list