]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/cpu: Clean up modalias feature matching
authorBen Hutchings <ben@decadent.org.uk>
Sat, 11 Feb 2012 22:57:19 +0000 (22:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Feb 2012 23:24:26 +0000 (15:24 -0800)
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
scripts/mod/file2alias.c

index 2dfa52bcdfe2c91de4f0f526a3f5fa175590d898..5502b289341bdd75971021cbd30c8fd3d9ec78c0 100644 (file)
@@ -63,7 +63,7 @@ ssize_t arch_print_cpu_modalias(struct device *dev,
                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 @@ ssize_t arch_print_cpu_modalias(struct device *dev,
                        buf += n;
                }
        }
-       *buf++ = ',';
        *buf++ = '\n';
        return buf - bufptr;
 }
index a468af059834bc37bbf75a6760a64686cfd0ba00..78fd81fb973290b878a61a4ff1f85b0b02cd75ec 100644 (file)
@@ -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, ":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;
 }
 ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry);