All of lore.kernel.org
 help / color / mirror / Atom feed
* [QUESTION] staging: When should static functions be marked inline?
@ 2026-11-30  8:28 Himanshu Bakshi
  2026-11-30  9:05 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Himanshu Bakshi @ 2026-11-30  8:28 UTC (permalink / raw)
  To: linux-staging

Hi everyone,

I have a question regarding the use of `static` and `static inline`
functions in the Linux kernel.

How do we decide whether a small `static` function should be marked `inline`?

For example, if a static function consists of only 2–3 lines of code,
is it worth declaring it as `static inline`, or should we generally
leave it as `static` and let the compiler decide whether to inline it?

I'd also like to understand what factors we should consider when
making this decision. Is it primarily about function call overhead,
code size, compiler optimization, or readability?

Would it be considered good practice to convert small static functions
into static inline functions, or is that generally discouraged unless
there is a specific reason?

I'd appreciate any guidance or references to relevant kernel documentation.

Thanks and regards,
Himanshu Bakshi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  8:28 [QUESTION] staging: When should static functions be marked inline? Himanshu Bakshi
2026-11-30  9:05 ` Dan Carpenter

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.