[PATCH v8 01/38] arm64: cpufeature: Always specify and use a field width for capabilities

Mark Brown broonie at kernel.org
Tue Jan 25 04:10:28 PST 2022


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220125/c9d8ca7a/attachment.sig>


More information about the linux-arm-kernel mailing list