]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: (arm) reuse parsed vendor ID
authorKarel Zak <kzak@redhat.com>
Tue, 10 Nov 2020 12:22:53 +0000 (13:22 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 13 Nov 2020 08:19:02 +0000 (09:19 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu.h

index 313efbd16e3327af19ee84cde6b431c20fda2f50..5611aacb733ad95520ae4f01476b1d905993a36e 100644 (file)
@@ -225,9 +225,16 @@ static int parse_id(const char *str)
        return id;
 }
 
-#define parse_implementer_id(_cxt)     (parse_id((_cxt)->vendor))
 #define parse_model_id(_cxt)           (parse_id((_cxt)->model))
 
+static inline int parse_implementer_id(struct lscpu_cputype *ct)
+{
+       if (ct->vendor_id)
+               return ct->vendor_id;
+       ct->vendor_id = parse_id(ct->vendor);
+       return ct->vendor_id;
+}
+
 /*
  * Use model and vendor IDs to decode to human readable names.
  */
index 7a8835f8792e04e811c4530ac66c05204c5df934..013d58f3c614462b912e698edaf4b5facb08f6f5 100644 (file)
@@ -57,6 +57,7 @@ struct lscpu_cputype {
        int     refcount;
 
        char    *vendor;
+       int     vendor_id;      /* created by lscpu_decode_arm() */
        char    *machinetype;   /* s390 */
        char    *family;
        char    *model;