Stefan Reinauer wrote:
In the following code snippet
static struct device_operations cpu_dev_ops = { .init = model_10xxx_init, }; static struct cpu_device_id cpu_table[] = { { X86_VENDOR_AMD, 0x100f00 }, /* SH-F0 L1 */ { X86_VENDOR_AMD, 0x100f10 }, /* M2 */ { X86_VENDOR_AMD, 0x100f20 }, /* S1g1 */ { X86_VENDOR_AMD, 0x100f21 }, { X86_VENDOR_AMD, 0x100f2A }, { X86_VENDOR_AMD, 0x100f22 }, { 0, 0 }, }; static struct cpu_driver model_10xxx __cpu_driver = { .ops = &cpu_dev_ops, .id_table = cpu_table, };
it would be 100% the same to have a cpu_table struct looking like this:
static struct cpu_device_id cpu_table[] = { { X86_VENDOR_AMD, 0x100f00 }, /* SH-F0 L1 */ { X86_VENDOR_AMD, 0x100f10 }, /* M2 */ { X86_VENDOR_AMD, 0x100f20 }, /* S1g1 */ { 0, 0 } };
No cpu caught by the version with the 6 IDs would ever fall through the 3 ID version. It's just duplicate code. If we really wanted to have special code in place for the 0x100f2A, we'd have to have a seperate struct cpu_driver anyways.
But if you don't have the stepping in the table you get: "WARNING: Using generic cpu ops". I think that I like warning if there is a stepping that hasn't been updated yet and no warning if it has.
Marc