]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
lspci: Replace unsigned long long type by u64 and %llx format by PCI_U64_FMT_X
authorPali Rohár <pali@kernel.org>
Sun, 26 Dec 2021 21:11:51 +0000 (22:11 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 10 Feb 2022 11:58:17 +0000 (12:58 +0100)
pciutils already provides and uses u64 type together with PCI_U64_FMT_X
format macro for printing hex value of this type. So use u64 and
PCI_U64_FMT_X also on other few remaining places.

This change fixes printing hexadecimal 64-bit numbers by lspci on Window
systems independently of used compiler (MinGW or MSVC).

ls-caps.c
ls-ecaps.c

index 79b61cd882e57a2a92181c742f5a16400ad2185f..b0caa50943d69619a2b9e000e692661112a9b03b 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -578,7 +578,7 @@ cap_ht(struct device *d, int where, int cmd)
            break;
          offl = get_conf_long(d, where + PCI_HT_MSIM_ADDR_LO);
          offh = get_conf_long(d, where + PCI_HT_MSIM_ADDR_HI);
-         printf("\t\tMapping Address Base: %016llx\n", ((unsigned long long)offh << 32) | (offl & ~0xfffff));
+         printf("\t\tMapping Address Base: %016" PCI_U64_FMT_X "\n", ((u64)offh << 32) | (offl & ~0xfffff));
        }
       break;
     case PCI_HT_CMD_TYP_DR:
index 1cea3153cdd9a4e40bc638c53ce34ee4b1497048..bd29c998940873b7fcd5e229ca40e93798a3430a 100644 (file)
@@ -68,12 +68,12 @@ cap_ltr(struct device *d, int where)
   snoop = get_conf_word(d, where + PCI_LTR_MAX_SNOOP);
   scale = cap_ltr_scale((snoop >> PCI_LTR_SCALE_SHIFT) & PCI_LTR_SCALE_MASK);
   printf("\t\tMax snoop latency: %lldns\n",
-        ((unsigned long long)snoop & PCI_LTR_VALUE_MASK) * scale);
+        ((u64)snoop & PCI_LTR_VALUE_MASK) * scale);
 
   nosnoop = get_conf_word(d, where + PCI_LTR_MAX_NOSNOOP);
   scale = cap_ltr_scale((nosnoop >> PCI_LTR_SCALE_SHIFT) & PCI_LTR_SCALE_MASK);
   printf("\t\tMax no snoop latency: %lldns\n",
-        ((unsigned long long)nosnoop & PCI_LTR_VALUE_MASK) * scale);
+        ((u64)nosnoop & PCI_LTR_VALUE_MASK) * scale);
 }
 
 static void
@@ -826,7 +826,7 @@ cap_l1pm(struct device *d, int where)
          if (scale > 5)
            printf(" LTR1.2_Threshold=<error>");
          else
-           printf(" LTR1.2_Threshold=%lldns", BITS(val, 16, 10) * (unsigned long long) cap_ltr_scale(scale));
+           printf(" LTR1.2_Threshold=%lldns", BITS(val, 16, 10) * (u64) cap_ltr_scale(scale));
        }
       printf("\n");
     }