summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChester Gillon <chester.gillon@metronet.co.uk>2021-09-05 13:37:56 +0100
committerChester Gillon <chester.gillon@metronet.co.uk>2022-04-03 09:15:27 +0100
commit831b467b2e3876c4e0c307d1e3eae2746ce805a7 (patch)
treec7a26c8f8ea40e67414df127d23c29ffb8634be3
parent28d6dd72e5d6fa907dbccd310cc516e7012a60bd (diff)
Obtain correct value of is_64 and is_prefetchable PCI device fields
Correct setting of the is_64 and is_prefetchable pci_device fields in pci_device_linux_sysfs_probe(). The pci_device struct defines is_64 and is_prefetchable as single bits, but the previous code was attempting to store the result of a bit-masked field in a single bit which always resulted in is_64 and is_prefetchable being zero regardless of the actual capabilities of the PCI device. Fixes: #15 Signed-off-by: Chester Gillon <chester.gillon@metronet.co.uk>
-rw-r--r--src/linux_sysfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
index d022644..d79404e 100644
--- a/src/linux_sysfs.c
+++ b/src/linux_sysfs.c
@@ -336,9 +336,9 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
dev->regions[i].size = (high_addr
- dev->regions[i].base_addr) + 1;
- dev->regions[i].is_IO = (flags & 0x01);
- dev->regions[i].is_64 = (flags & 0x04);
- dev->regions[i].is_prefetchable = (flags & 0x08);
+ dev->regions[i].is_IO = (flags & 0x01) != 0;
+ dev->regions[i].is_64 = (flags & 0x04) != 0;
+ dev->regions[i].is_prefetchable = (flags & 0x08) != 0;
}
}