提交 5467bdda 编写于 作者: B Ben Hutchings 提交者: Greg Kroah-Hartman

x86/cpu: Clean up modalias feature matching

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: NBen Hutchings <ben@decadent.org.uk>
Acked-by: NThomas Renninger <trenn@suse.de>
Acked-by: NH. Peter Anvin <hpa@zytor.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 70142a9d
...@@ -63,7 +63,7 @@ ssize_t arch_print_cpu_modalias(struct device *dev, ...@@ -63,7 +63,7 @@ ssize_t arch_print_cpu_modalias(struct device *dev,
boot_cpu_data.x86_model); boot_cpu_data.x86_model);
size -= n; size -= n;
buf += n; buf += n;
size -= 2; size -= 1;
for (i = 0; i < NCAPINTS*32; i++) { for (i = 0; i < NCAPINTS*32; i++) {
if (boot_cpu_has(i)) { if (boot_cpu_has(i)) {
n = snprintf(buf, size, ",%04X", i); n = snprintf(buf, size, ",%04X", i);
...@@ -75,7 +75,6 @@ ssize_t arch_print_cpu_modalias(struct device *dev, ...@@ -75,7 +75,6 @@ ssize_t arch_print_cpu_modalias(struct device *dev,
buf += n; buf += n;
} }
} }
*buf++ = ',';
*buf++ = '\n'; *buf++ = '\n';
return buf - bufptr; return buf - bufptr;
} }
......
...@@ -1021,8 +1021,9 @@ static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id, ...@@ -1021,8 +1021,9 @@ static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id,
ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor); ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor);
ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family); ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family);
ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model); ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model);
ADD(alias, ":feature:*,", id->feature != X86_FEATURE_ANY, id->feature); strcat(alias, ":feature:*");
strcat(alias, ",*"); if (id->feature != X86_FEATURE_ANY)
sprintf(alias + strlen(alias), "%04X*", id->feature);
return 1; return 1;
} }
ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry); ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册