Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp854411pja; Wed, 1 Apr 2020 09:53:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvmFQfUeoTopPwQDL5WsBR9lmZYPdJuZwo/EGpXTR6Yj1N7aQJMUQTyybtXgKFR7jFPmX/3 X-Received: by 2002:a4a:8585:: with SMTP id t5mr5166316ooh.39.1585760024284; Wed, 01 Apr 2020 09:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585760024; cv=none; d=google.com; s=arc-20160816; b=P4e5bxje3cad85vP944ZvGIRV2/7D/x9VApYTPdF2yoOhxzAjnNCaPXwpxi9qugtHL IuUgMoql4thr+f36LBLOxB6GyqtPxmxgfc/MET5jNgM0yEIuJ7UQA1LoXLAZv3N8rQqz tNbwuKcEexfYCSdttqqeC/md9oVa8/CrXJu3/awndqK/KbTUkUcuh7tovG9r1+S/nb7Q 83Hc4+B48d2HAKlJVpLZ2zDu+iq+XRgBXfkQgauQU7UAo1Hptnmq65pss19ZCX0f+uh+ Qg33iYQuntYnoIZ8ivp1CM4wKWfAboqnm1pYAbstUW4RktG9wZlEP4a/99W/ElL2DALH zlOQ== 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=vTPdo9W9lSKLw2KRgzV2CJu3fjmyFiUWkDz6fOHQSSc=; b=R0Un382gHqeK+CGHHd0J+OQfHVxWW18aBkT4sMPiBqiSNLPAd12HRsqL1SomG7Io7P 9SOChZ/egy3/IG7To+nnDgFeKecNX6SFmkfX1Oq+HdGpXfumH7oj7SOZ7Kd1HJqycc4j GzDILk0JOTNfk7SHhn6SlGxbDJtvkA8MgJ1tRlMSEVWlR7JV3dXtLewuIL+RxmyYQ4fZ 7dVBYE3XCf3QpJ8FjaGnm9RDzXsYvYji6Y8ROswaitleRVwWMdO1JZoz1DPA0D6foZuf nBd/x6+9IhCYCawFx/o9Mx5fmIumfHHi3xxHUl9JWUN7R1803GgO9FvjAZDqsXlbWb7w v1lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IZoz8kAL; 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 l4si924063otf.195.2020.04.01.09.53.31; Wed, 01 Apr 2020 09:53:44 -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=IZoz8kAL; 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 S2388923AbgDAQhH (ORCPT + 99 others); Wed, 1 Apr 2020 12:37:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:36158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388914AbgDAQhC (ORCPT ); Wed, 1 Apr 2020 12:37:02 -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 4CD2F20658; Wed, 1 Apr 2020 16:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585759021; bh=EY5R1QC2UFt4ZgEOuanrzEih+GHs096R2FsqatSo/3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZoz8kALSLujuHUwO7UJ63rCQe9xapmefw1R23Is3TW3GEBaS1PCaTqU/meVPZCAm HW3rxOFFwLKpADPmtWwBio8DI+d198DAgXpiTqw8AXAkK8m7Ba4Ugw3UQ1sTOn+RL+ sVBjKiDivif55XaxJoECBIdA4vmnP0smb8px2LlA= 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 4.9 052/102] cpupower: avoid multiple definition with gcc -fno-common Date: Wed, 1 Apr 2020 18:17:55 +0200 Message-Id: <20200401161542.671959728@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161530.451355388@linuxfoundation.org> References: <20200401161530.451355388@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 2116df9ad8325..c097a3748674f 100644 --- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c @@ -83,7 +83,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 5b3205f162174..5277df27191f3 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c @@ -21,7 +21,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 05f953f0f0a0c..80a21cb67d94f 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c @@ -29,6 +29,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 9e43f3371fbc6..3558bbae2b5dc 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h @@ -18,7 +18,7 @@ #define CSTATE_NAME_LEN 5 #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