58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
From: Ben Hutchings <ben@decadent.org.uk>
|
|
Date: Sat, 11 Feb 2012 22:57:19 +0000
|
|
Subject: x86/cpu: Clean up modalias feature matching
|
|
|
|
commit 5467bdda4a326513c2f14b712a22d59115b7ae94 upstream.
|
|
|
|
We currently include commas on both sides of the feature ID in a
|
|
modalias, but this prevents the lowest numbered feature of a CPU from
|
|
being matched. Since all feature IDs have the same length, we do not
|
|
need to worry about substring matches, so omit commas from the
|
|
modalias entirely.
|
|
|
|
Avoid generating multiple adjacent wildcards when there is no
|
|
feature ID to match.
|
|
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
Acked-by: Thomas Renninger <trenn@suse.de>
|
|
Acked-by: H. Peter Anvin <hpa@zytor.com>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
arch/x86/kernel/cpu/match.c | 3 +--
|
|
scripts/mod/file2alias.c | 5 +++--
|
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
--- a/arch/x86/kernel/cpu/match.c
|
|
+++ b/arch/x86/kernel/cpu/match.c
|
|
@@ -63,7 +63,7 @@
|
|
boot_cpu_data.x86_model);
|
|
size -= n;
|
|
buf += n;
|
|
- size -= 2;
|
|
+ size -= 1;
|
|
for (i = 0; i < NCAPINTS*32; i++) {
|
|
if (boot_cpu_has(i)) {
|
|
n = snprintf(buf, size, ",%04X", i);
|
|
@@ -75,7 +75,6 @@
|
|
buf += n;
|
|
}
|
|
}
|
|
- *buf++ = ',';
|
|
*buf++ = '\n';
|
|
return buf - bufptr;
|
|
}
|
|
--- a/scripts/mod/file2alias.c
|
|
+++ b/scripts/mod/file2alias.c
|
|
@@ -898,8 +898,9 @@
|
|
ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor);
|
|
ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family);
|
|
ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model);
|
|
- ADD(alias, ":feature:*,", id->feature != X86_FEATURE_ANY, id->feature);
|
|
- strcat(alias, ",*");
|
|
+ strcat(alias, ":feature:*");
|
|
+ if (id->feature != X86_FEATURE_ANY)
|
|
+ sprintf(alias + strlen(alias), "%04X*", id->feature);
|
|
return 1;
|
|
}
|
|
|