From patchwork Mon Apr 13 20:24:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 6211661 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E13ABF4A6 for ; Mon, 13 Apr 2015 20:30:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42FF3202E6 for ; Mon, 13 Apr 2015 20:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5826A202D1 for ; Mon, 13 Apr 2015 20:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754860AbbDMUaj (ORCPT ); Mon, 13 Apr 2015 16:30:39 -0400 Received: from ns.lynxeye.de ([87.118.118.114]:37558 "EHLO lynxeye.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754742AbbDMUai (ORCPT ); Mon, 13 Apr 2015 16:30:38 -0400 X-Greylist: delayed 392 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Apr 2015 16:30:38 EDT Received: by lynxeye.de (Postfix, from userid 501) id 2670926C2002; Mon, 13 Apr 2015 22:24:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from tellur.intern.lynxeye.de (p57B5EC68.dip0.t-ipconnect.de [87.181.236.104]) by lynxeye.de (Postfix) with ESMTPA id 28FEB26C2001; Mon, 13 Apr 2015 22:24:04 +0200 (CEST) From: Lucas Stach To: Thomas Renninger Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpupower: fix breakage from libpci API change Date: Mon, 13 Apr 2015 22:24:01 +0200 Message-Id: <1428956641-7765-1-git-send-email-dev@lynxeye.de> X-Mailer: git-send-email 2.1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Thomas Renninger --- tools/power/cpupower/utils/helpers/pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/power/cpupower/utils/helpers/pci.c b/tools/power/cpupower/utils/helpers/pci.c index 9690798..8b27898 100644 --- a/tools/power/cpupower/utils/helpers/pci.c +++ b/tools/power/cpupower/utils/helpers/pci.c @@ -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);