From 9c12bcfdc52d7887c26d97bfcb8eb5fc86f2bc1a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 7 Jan 2019 09:32:16 +0100 Subject: Fix format warnings --- cpukit/libpci/pci_bus.c | 8 +++++--- cpukit/libpci/pci_cfg_print_code.c | 11 ++++++----- cpukit/libpci/pci_print.c | 23 +++++++++++++---------- 3 files changed, 24 insertions(+), 18 deletions(-) (limited to 'cpukit/libpci') diff --git a/cpukit/libpci/pci_bus.c b/cpukit/libpci/pci_bus.c index 2172e720bd..115deebd8d 100644 --- a/cpukit/libpci/pci_bus.c +++ b/cpukit/libpci/pci_bus.c @@ -26,6 +26,7 @@ /* On small systems undefine PCIBUS_INFO to avoid sprintf get dragged in */ #define PCIBUS_INFO +#include #include #include #include @@ -301,7 +302,7 @@ void pcibus_dev_info( sprintf(buf, "LOCATION: BUS:SLOT:FUNCTION [%x:%x:%x]", PCI_DEV_EXPAND(devinfo->pcidev)); print_line(p, buf); - sprintf(buf, "PCIID 0x%lx", (uint32_t)devinfo->pcidev); + sprintf(buf, "PCIID 0x%" PRIx16 "", devinfo->pcidev); print_line(p, buf); sprintf(buf, "VENDOR ID: %04x", devinfo->id.vendor); print_line(p, buf); @@ -311,7 +312,7 @@ void pcibus_dev_info( print_line(p, buf); sprintf(buf, "SUBDEV ID: %04x", devinfo->id.subdevice); print_line(p, buf); - sprintf(buf, "CLASS: %lx", devinfo->id.class); + sprintf(buf, "CLASS: %" PRIx32, devinfo->id.class); print_line(p, buf); sprintf(buf, "REVISION: %x", devinfo->rev); print_line(p, buf); @@ -343,7 +344,8 @@ void pcibus_dev_info( if (!pcibusres->size) continue; - sprintf(buf, " %s[%d]: %08lx-%08lx [PCIADR %lx]", + sprintf(buf, " %s[%d]: %08" PRIx32 "-%08" PRIx32 + " [PCIADR %" PRIx32 "]", str1, i, pcibusres->address, pcibusres->address + pcibusres->size - 1, pcistart); print_line(p, buf); diff --git a/cpukit/libpci/pci_cfg_print_code.c b/cpukit/libpci/pci_cfg_print_code.c index a921f00529..e758fa661a 100644 --- a/cpukit/libpci/pci_cfg_print_code.c +++ b/cpukit/libpci/pci_cfg_print_code.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -49,12 +50,12 @@ static void pci_cfg_print_resources(struct pci_res *resources, char *prefix) } printf("%s{\n", prefix); printf("%s\t.next = NULL,\n", prefix); - printf("%s\t.size = 0x%08lx,\n", prefix, res->size); - printf("%s\t.boundary = 0x%08lx,\n", prefix, res->boundary); + printf("%s\t.size = 0x%08" PRIx32 ",\n", prefix, res->size); + printf("%s\t.boundary = 0x%08" PRIx32 ",\n", prefix, res->boundary); printf("%s\t.flags = 0x%x,\n", prefix, res->flags); printf("%s\t.bar = %d,\n", prefix, i); - printf("%s\t.start = 0x%08lx,\n", prefix, res->start); - printf("%s\t.end = 0x%08lx,\n", prefix, res->end); + printf("%s\t.start = 0x%08" PRIx32 ",\n", prefix, res->start); + printf("%s\t.end = 0x%08" PRIx32 ",\n", prefix, res->end); printf("%s},\n", prefix); } } @@ -88,7 +89,7 @@ static void pci_cfg_print_device(struct pci_dev *dev, char *prefix) printf("%s.device = 0x%04x,\n", prefix, dev->device); printf("%s.subvendor = 0x%04x,\n", prefix, dev->subvendor); printf("%s.subdevice = 0x%04x,\n", prefix, dev->subdevice); - printf("%s.classrev = 0x%08lx,\n", prefix, dev->classrev); + printf("%s.classrev = 0x%08" PRIx32 ",\n", prefix, dev->classrev); printf("%s.command = 0,\n", prefix); } diff --git a/cpukit/libpci/pci_print.c b/cpukit/libpci/pci_print.c index e0835d9323..7c021d8df9 100644 --- a/cpukit/libpci/pci_print.c +++ b/cpukit/libpci/pci_print.c @@ -7,6 +7,7 @@ * http://www.rtems.org/license/LICENSE. */ +#include #include #include #include @@ -42,11 +43,12 @@ void pci_print_dev(pci_dev_t dev) PCI_CFG_R32(dev, PCIR_VENDOR, &id); printf("\nBus %x Slot %x function: %x [0x%x] %s\n", PCI_DEV_EXPAND(dev), dev, str); - printf("\tVendor id: 0x%lx, device id: 0x%lx\n", + printf("\tVendor id: 0x%" PRIx32 ", device id: 0x%" PRIx32 "\n", id & 0xffff, id >> 16); if (maxbars == 2) { PCI_CFG_R32(dev, PCIR_PRIBUS_1, &tmp); - printf("\tPrimary: %lx Secondary: %lx Subordinate: %lx\n", + printf("\tPrimary: %" PRIx32 " Secondary: %" PRIx32 + " Subordinate: %" PRIx32 "\n", tmp & 0xff, (tmp >> 8) & 0xff, (tmp >> 16) & 0xff); } @@ -82,7 +84,8 @@ void pci_print_dev(pci_dev_t dev) str = "MB"; tmp2 = tmp2 / (1024*1024); } - printf("\tBAR %d: %lx [%lu%s]\n", pos, tmp, tmp2, str); + printf("\tBAR %d: %" PRIx32 " [%" PRIu32 "%s]\n", + pos, tmp, tmp2, str); } } @@ -105,7 +108,7 @@ void pci_print_dev(pci_dev_t dev) tmp2 = tmp2 / (1024*1024); } str2 = tmp & 1 ? "ENABLED" : "DISABLED"; - printf("\tROM: %08lx [%lu%s] (%s)\n", + printf("\tROM: %08" PRIx32 " [%" PRIu32 "%s] (%s)\n", tmp, tmp2, str, str2); } @@ -122,8 +125,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tI/O: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tI/O: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } PCI_CFG_R32(dev, 0x20, &tmp); @@ -133,8 +136,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tMEMIO: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tMEMIO: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } PCI_CFG_R32(dev, 0x24, &tmp); @@ -144,8 +147,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tMEM: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tMEM: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } } printf("\n"); -- cgit v1.2.3