Skip to content

Commit fb3eb96

Browse files
Fix build with older libpci versions
1 parent 8d66330 commit fb3eb96

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/detection/gpu/gpu_linux.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,16 @@ static void pciDetectVendorName(FFGPUResult* gpu, PCIData* pci, struct pci_dev*
6161

6262
static void drmDetectDeviceName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* device)
6363
{
64-
#if PCI_LIB_VERSION >= 0x030800
65-
pci->ffpci_fill_info(device, PCI_FILL_CLASS_EXT);
66-
#endif
64+
bool revIdSet = false;
6765

68-
#ifndef __FreeBSD__
69-
if((device->known_fields & PCI_FILL_CLASS_EXT) == 0)
70-
device->rev_id = pci->ffpci_read_byte(device, PCI_REVISION_ID);
66+
#if PCI_LIB_VERSION >= 0x030800
67+
revIdSet = pci->ffpci_fill_info(device, PCI_FILL_CLASS_EXT) & PCI_FILL_CLASS_EXT;
68+
#elif __FreeBSD__
69+
return;
7170
#endif
7271

73-
if((device->known_fields & PCI_FILL_CLASS) == 0)
74-
return;
72+
if(!revIdSet)
73+
device->rev_id = pci->ffpci_read_byte(device, PCI_REVISION_ID);
7574

7675
FFstrbuf query;
7776
ffStrbufInit(&query);

0 commit comments

Comments
 (0)