On 17.11.2025 23:21, Andrew Cooper wrote: > Using typeof() in wait_for_state()/set_state() unnecesserily cryptic, and more > verbose than using a proper type. > > No functional change. > > Signed-off-by: Andrew Cooper <[email protected]>
I don't strictly mind the change, so Acked-by: Jan Beulich <[email protected]> but I think the use of typeof() also has its benefits: > @@ -237,9 +238,9 @@ static bool cf_check wait_cpu_callout(unsigned int nr) > return atomic_read(&cpu_out) >= nr; > } > > -static bool wait_for_state(typeof(loading_state) state) > +static bool wait_for_state(loading_state_t state) > { > - typeof(loading_state) cur_state; > + loading_state_t cur_state; > > while ( (cur_state = ACCESS_ONCE(loading_state)) != state ) > { Even if the type of loading_state changed, no type mismatches would result here. Or in other words, a type adjustment there would not entail code changes here and ... > @@ -251,7 +252,7 @@ static bool wait_for_state(typeof(loading_state) state) > return true; > } > > -static void set_state(typeof(loading_state) state) > +static void set_state(loading_state_t state) > { > ACCESS_ONCE(loading_state) = state; > } ... here (which could easily be forgotten as the compiler might not flag such mismatches). Thing of course is that the type of loading_state is pretty unlikely to change. Jan
