Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3284777ybb; Tue, 31 Mar 2020 02:05:28 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsgT0J0JCV/hiXCR3QvqSK0LlYYKSxYN/bPoghzqo8e3KAo9KA2CexUaK7wHss1/minKBrk X-Received: by 2002:aca:34c6:: with SMTP id b189mr1351342oia.63.1585645528047; Tue, 31 Mar 2020 02:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645528; cv=none; d=google.com; s=arc-20160816; b=TrBhxpoMzshJs4Z4Gm3JY+gNgoxeG9o23ePTUAW3VWZFUXTxguiHjslfj+0vH3SFfX M1inLmMfmOxTXouQ42xSeUeqpAXaes8+NJiFW/676jxPrKCyxmiLQbyPOhmEP4bE9jVX ecx1zDPwq7rC1OXyrOiqvdxFDSiZfh+9zbpYh47cB7JkDgEKw/Lc+Y+u4iHKChLwZPRe 8qq50Ru8SHg4RhdcAGRCxad80nNwk3irMbV1kWEvHQ5Wb6petuJdMprwQF8BUWnxhlFV E+rfJBAaFLH8V1QCYAKxo9GBURtohGpX/r0CFgbuYsurtowlFYCRxyNMECwN0i1lX/Y4 ddAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AY2TFRcoOl8Em90XXlyT4mjtnzJ1MqLJH/zHMCi23VA=; b=gWrt24VngwYBRyTQrPaSCE3xxJtB/6YfILalcAjXyd9nFOFiCmqR2I1n7g6fJE0wob JymTwVsibeEpKH0i8dD2WnmyfzcVCFDVdGmtqFAOUf1Jemauwpp2BE0GEHgA+FP5cHRk 9cXpomuSApd1AknBypmhKEH4aTjiguPxVva3WMazOJQxMD5cWmbQi9y+kbpYrX1LpAxs uBn+CDKjNEVd5sYzINiTeeacsPRqTLMIiKIqTYLIhNU7cZ1L0cRfw7r2VIhopi22jdjZ gKEJunnTX4xWmeWul+nUw7E9c4wgeDAQMZ+tJr2/i5CKUIYNoYFywP6totSW0LPP+v50 yHeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MkrJBJch; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n82si6668668oih.195.2020.03.31.02.05.15; Tue, 31 Mar 2020 02:05:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MkrJBJch; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730991AbgCaJEo (ORCPT + 99 others); Tue, 31 Mar 2020 05:04:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:45484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730981AbgCaJEl (ORCPT ); Tue, 31 Mar 2020 05:04:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84A5F20675; Tue, 31 Mar 2020 09:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645481; bh=VqEqUvE1uiOqnKcDCafxpJOR4GQ+8JVfFeq04ZrpxiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkrJBJchN/S2YqSM7VnkovlKod/SdnsG2CAheXSLwrRdzAPgJzTGHW1jnErQPfvak GMnLY4im3gnOf37s1MnZF9nqMxlR3PizbtHbdngRFu1CgPPvC5wG3DK0rmcVyzyCZe CHJ7sI0CTv2ekGbzUxUau/Alicb4danlOkneyO08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Gilbert , Shuah Khan , Sasha Levin Subject: [PATCH 5.5 066/170] cpupower: avoid multiple definition with gcc -fno-common Date: Tue, 31 Mar 2020 10:58:00 +0200 Message-Id: <20200331085431.470300624@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Gilbert [ Upstream commit 2de7fb60a4740135e03cf55c1982e393ccb87b6b ] Building cpupower with -fno-common in CFLAGS results in errors due to multiple definitions of the 'cpu_count' and 'start_time' variables. ./utils/idle_monitor/snb_idle.o:./utils/idle_monitor/cpupower-monitor.h:28: multiple definition of `cpu_count'; ./utils/idle_monitor/nhm_idle.o:./utils/idle_monitor/cpupower-monitor.h:28: first defined here ... ./utils/idle_monitor/cpuidle_sysfs.o:./utils/idle_monitor/cpuidle_sysfs.c:22: multiple definition of `start_time'; ./utils/idle_monitor/amd_fam14h_idle.o:./utils/idle_monitor/amd_fam14h_idle.c:85: first defined here The -fno-common option will be enabled by default in GCC 10. Bug: https://bugs.gentoo.org/707462 Signed-off-by: Mike Gilbert Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +- tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +- tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++ tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c index 33dc34db4f3cc..20f46348271b1 100644 --- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c @@ -82,7 +82,7 @@ static struct pci_access *pci_acc; static struct pci_dev *amd_fam14h_pci_dev; static int nbp1_entered; -struct timespec start_time; +static struct timespec start_time; static unsigned long long timediff; #ifdef DEBUG diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c index 3c4cee160b0e6..a65f7d011513a 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c @@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor; static unsigned long long **previous_count; static unsigned long long **current_count; -struct timespec start_time; +static struct timespec start_time; static unsigned long long timediff; static int cpuidle_get_count_percent(unsigned int id, double *percent, diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c index 6d44fec55ad5a..7c77045fef52f 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c @@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = { 0 }; +int cpu_count; + static struct cpuidle_monitor *monitors[MONITORS_MAX]; static unsigned int avail_monitors; diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h index 5b5eb1da0cce3..c559d3115330a 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h @@ -25,7 +25,7 @@ #endif #define CSTATE_DESC_LEN 60 -int cpu_count; +extern int cpu_count; /* Hard to define the right names ...: */ enum power_range_e { -- 2.20.1