summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2011-07-04 07:38:33 +0200
committerEgbert Eich <eich@freedesktop.org>2013-01-03 10:22:54 -0500
commit0ad7b5c548ecf409a1fdd835bde52a8cf5371b7a (patch)
tree40d5451a9505c3465bade28762489e9e38f42d9a
parent72e0c0b4d4680b7a7b4b42be525d406635dae40f (diff)
downloadxorg-lib-libpciaccess-0ad7b5c548ecf409a1fdd835bde52a8cf5371b7a.tar.gz
PCI: set correct mask value when matching for bridges.
The mask must not be zero otherwise the matching condition will never be true: ((val & mask) == set). Signed-off-by: Egbert Eich <eich@freedesktop.org> Reviewed-by: Guillem Jover <guillem@hadrons.org>
-rw-r--r--src/common_bridge.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common_bridge.c b/src/common_bridge.c
index 4a067b9..82a13fd 100644
--- a/src/common_bridge.c
+++ b/src/common_bridge.c
@@ -321,6 +321,8 @@ pci_device_get_bridge_buses(struct pci_device * dev, int *primary_bus,
#define PCI_CLASS_BRIDGE 0x06
#define PCI_SUBCLASS_BRIDGE_PCI 0x04
+#define PCI_CLASS_MASK 0xFF
+#define PCI_SUBCLASS_MASK 0xFF
struct pci_device *
pci_device_get_parent_bridge(struct pci_device *dev)
@@ -328,7 +330,7 @@ pci_device_get_parent_bridge(struct pci_device *dev)
struct pci_id_match bridge_match = {
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
(PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8),
- 0
+ (PCI_CLASS_MASK << 16) | (PCI_SUBCLASS_MASK << 8)
};
struct pci_device *bridge;