On Tue, Jan 25, 2022 at 10:57:47AM +0000, Suzuki K Poulose wrote:
On 25/01/2022 00:10, Mark Brown wrote:
- int val = cpuid_feature_extract_field_width(reg, entry->field_pos,
entry->field_width,
entry->sign);
Could we do something like :
- int val = cpuid_feature_extract_field_width(reg, entry->field_pos, entry->field_width ? : 4, .. );
and leave the existing structures as they are ?
Obviously we *could* (ideally without the ternery operator) but having the implicit default like that makes me nervous that it's too easy to just forget to fill it in and get the wrong default.
And that could avoid these changes too. We could add :
#define HWCAP_CPUID_MATCH_WIDTH(...)
when/if we need one, which sets the width.
I'd originally had a completely separate set of definitions for single bit fields but Catlain wanted to get everything in one. I'm not sure I see a huge advantage in sharing the match function and not also sharing the macro TBH.