On 06.07.2025 19:34, Sergii Dmytruk wrote: > On Wed, Jul 02, 2025 at 04:57:12PM +0200, Jan Beulich wrote: >>> @@ -440,9 +436,10 @@ static DEFINE_SPINLOCK(set_atomicity_lock); >>> * has been called. >>> */ >>> >>> -static bool prepare_set(void) >>> +struct mtrr_pausing_state mtrr_pause_caching(void) >> >> These becoming non-static without being called from anywhere else isn't >> going to >> be liked by Misra. Hence the part of static -> extern may need to be deferred >> until the new user(s) appear(s). > > Sounds like small part needs to be moved into the next patch. > >> Furthermore this returning of a struct by value isn't very nice, and looks >> to be >> easy to avoid here. > > Are you suggesting to use an output parameter instead?
Yes. > Out of curiosity, what's bad in returning trivial structs by value? It's generally deemed bad practice from all I know, to a fair degree because of this then (generally) translating to a hidden function argument. While not relevant here, this also is a corner case of the respective psABI, which is more likely to cause interoperability issues. Jan