cpupower: fix breakage from libpci API change
PATCH 1/1 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.
--- tools/power/cpupower/utils/helpers/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/power/cpupower/utils/helpers/pci.c +9 -2
@@ -25,14 +25,21 @@struct pci_dev *pci_acc_init (struct pci_access **pacc,int domain,int bus,int slot,int func,int vendor,int dev) { -struct pci_filter filter_nb_link = { domain, bus, slot, func, - vendor, dev }; +struct pci_filter filter_nb_link;struct pci_dev *device; *pacc =pci_alloc ();if (*pacc ==NULL )return NULL ; +pci_filter_init (*pacc, &filter_nb_link); + filter_nb_link.domain = domain; + filter_nb_link.bus = bus; + filter_nb_link.slot = slot; + filter_nb_link.func = func; + filter_nb_link.vendor = vendor; + filter_nb_link.device = dev; +pci_init (*pacc);pci_scan_bus (*pacc);
Signature · 1 line
2.1.0
Hi,
Quoted 3 lines · Lucas Stach
libpci 3.3.0 introduced an additional member in the
pci_filterstruct which needs to be initialized to -1 to get the same behavior as before the API change.
Sounds not that clever, but there probably is a reason for this...
I am not that familiar with the pci lib and its recent changes, but below patch looks reasonable.
Quoted 42 lines
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]>--- tools/power/cpupower/utils/helpers/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/tools/power/cpupower/utils/helpers/pci.cindex 9690798..8b27898 100644tools/power/cpupower/utils/helpers/pci.c +9
-2@@ -25,14 +25,21 @@struct pci_dev *pci_acc_init (struct pci_access **pacc,int domain,int bus,int slot,int func,int vendor,int dev) { -struct pci_filter filter_nb_link = { domain, bus, slot, func, - vendor, dev }; +struct pci_filter filter_nb_link;struct pci_dev *device; *pacc =pci_alloc ();if (*pacc ==NULL )return NULL ; +pci_filter_init (*pacc, &filter_nb_link); + filter_nb_link.domain = domain; + filter_nb_link.bus = bus; + filter_nb_link.slot = slot; + filter_nb_link.func = func; + filter_nb_link.vendor = vendor; + filter_nb_link.device = dev; +pci_init (*pacc);pci_scan_bus (*pacc);
So, who is going to pick up this patch?
Regards,
Lucas
Am Dienstag, den 14.04.2015, 18:28 +0200 schrieb Thomas Renninger:
Quoted 57 lines
Hi,
Quoted 3 lines · Lucas Stach
libpci 3.3.0 introduced an additional member in the
pci_filterstruct which needs to be initialized to -1 to get the same behavior as before the API change.Sounds not that clever, but there probably is a reason for this...
I am not that familiar with the pci lib and its recent changes, but below patch looks reasonable.
Acked-by Thomas Renninger <[email protected]>Quoted 42 lines
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]>--- tools/power/cpupower/utils/helpers/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/tools/power/cpupower/utils/helpers/pci.cindex 9690798..8b27898 100644tools/power/cpupower/utils/helpers/pci.c +9
-2@@ -25,14 +25,21 @@struct pci_dev *pci_acc_init (struct pci_access **pacc,int domain,int bus,int slot,int func,int vendor,int dev) { -struct pci_filter filter_nb_link = { domain, bus, slot, func, - vendor, dev }; +struct pci_filter filter_nb_link;struct pci_dev *device; *pacc =pci_alloc ();if (*pacc ==NULL )return NULL ; +pci_filter_init (*pacc, &filter_nb_link); + filter_nb_link.domain = domain; + filter_nb_link.bus = bus; + filter_nb_link.slot = slot; + filter_nb_link.func = func; + filter_nb_link.vendor = vendor; + filter_nb_link.device = dev; +pci_init (*pacc);pci_scan_bus (*pacc);
Quoted 1 line · Lucas Stach
So, who is going to pick up this patch?
Should be in the Linus' tree already, isn't it?
I pick up PM tools patches if ACKed by their respective maintainers as a rule.
turbostat is an exception.
Quoted 64 lines
Am Dienstag, den 14.04.2015, 18:28 +0200 schrieb Thomas Renninger:
Quoted 46 lines
Hi,
Quoted 3 lines · Lucas Stach
libpci 3.3.0 introduced an additional member in the
pci_filterstruct which needs to be initialized to -1 to get the same behavior as before the API change.Sounds not that clever, but there probably is a reason for this...
I am not that familiar with the pci lib and its recent changes, but below patch looks reasonable.
Acked-by Thomas Renninger <[email protected]>Quoted 32 lines
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]>--- tools/power/cpupower/utils/helpers/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/tools/power/cpupower/utils/helpers/pci.cindex 9690798..8b27898 100644tools/power/cpupower/utils/helpers/pci.c +1
-2@@ -25,14 +25,21 @@struct pci_dev *pci_acc_init (struct pci_access **pacc,int domain,int bus,int slot,int func,int vendor,int dev) { -struct pci_filter filter_nb_link = { domain, bus, slot, func, - vendor, dev }; +struct pci_filter filter_nb_link;struct pci_dev *device; *pacc =pci_alloc ();if (*pacc ==NULL )return NULL ;Quoted 11 lines
tools/power/cpupower/utils/helpers/pci.c line 44
Quoted 10 lines
tools/power/cpupower/utils/helpers/pci.c +8
-0+pci_filter_init (*pacc, &filter_nb_link); + filter_nb_link.domain = domain; + filter_nb_link.bus = bus; + filter_nb_link.slot = slot; + filter_nb_link.func = func; + filter_nb_link.vendor = vendor; + filter_nb_link.device = dev; +pci_init (*pacc);pci_scan_bus (*pacc);--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.