Re: [RFC PATCH v2 3/5] driver: hwpf: Add support for Intel to hardware prefetch driver

From: Dave Hansen
Date: Sun Nov 07 2021 - 20:51:08 EST


On 11/3/21 10:21 PM, Kohei Tarumizu wrote:
> +enum register_type __init get_register_type(void)
> +{
> + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
> + return REGISTER_TYPE_NONE;
> +
> + switch (boot_cpu_data.x86_model) {
> + /*
> + * Note: In addition to BROADWELL, NEHALEM and others have same register
> + * specifications as REGISTER_TYPE_BROADWELL. If you want to add support
> + * for these processor, add the target model case here.
> + */
> + case INTEL_FAM6_BROADWELL_X:
> + return REGISTER_TYPE_BROADWELL;
> + default:
> + return REGISTER_TYPE_NONE;
> + }
> +}

Can you do this with a struct and x86_match_cpu() instead?