Skip to content

Commit 06b230e

Browse files
lynxeye-devrafaeljw
authored andcommitted
cpupower: fix breakage from libpci API change
libpci 3.3.0 introduced an additional member in the pci_filter struct which needs to be initialized to -1 to get the same behavior as before the API change. The libpci internal helpers got updated accordingly, but as the cpupower pci helpers initialized the struct themselves the behavior changed. Use the libpci helper pci_filter_init() to fix this and guard against similar breakages in the future. This fixes probing of the AMD fam12h/14h cpuidle monitor on systems with libpci >= 3.3.0. Signed-off-by: Lucas Stach <[email protected]> Acked-by: Thomas Renninger <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 39a8804 commit 06b230e

File tree

1 file changed

+9
-2
lines changed
  • tools/power/cpupower/utils/helpers

1 file changed

+9
-2
lines changed

tools/power/cpupower/utils/helpers/pci.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,21 @@
2525
struct pci_dev *pci_acc_init(struct pci_access **pacc, int domain, int bus,
2626
int slot, int func, int vendor, int dev)
2727
{
28-
struct pci_filter filter_nb_link = { domain, bus, slot, func,
29-
vendor, dev };
28+
struct pci_filter filter_nb_link;
3029
struct pci_dev *device;
3130

3231
*pacc = pci_alloc();
3332
if (*pacc == NULL)
3433
return NULL;
3534

35+
pci_filter_init(*pacc, &filter_nb_link);
36+
filter_nb_link.domain = domain;
37+
filter_nb_link.bus = bus;
38+
filter_nb_link.slot = slot;
39+
filter_nb_link.func = func;
40+
filter_nb_link.vendor = vendor;
41+
filter_nb_link.device = dev;
42+
3643
pci_init(*pacc);
3744
pci_scan_bus(*pacc);
3845

0 commit comments

Comments
 (0)