From patchwork Fri Apr 3 13:19:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 6156911 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBDC79F389 for ; Fri, 3 Apr 2015 13:22:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2BB46203B1 for ; Fri, 3 Apr 2015 13:22:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2261F202E6 for ; Fri, 3 Apr 2015 13:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752423AbbDCNV5 (ORCPT ); Fri, 3 Apr 2015 09:21:57 -0400 Received: from mail.skyhub.de ([78.46.96.112]:37433 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbbDCNV4 (ORCPT ); Fri, 3 Apr 2015 09:21:56 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1428067315; bh=/bzx/wT6ABhq5/XM6RTxNj2AQ8sMaOP+dEh9IowywqM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding; b=Lnikg7tJBU1i4L7HEm9xd1f4rJXlJ8Y5PDVh2 wUtVlVcVhriAhqZDQPk4DyXBreE4B7Dn2cgTYsR4yrktjpm3hHG7Se+yLq8oSNUlCKd VnE1flmfIm3ZHcsbZbU+DC7RrtxYx73UKU0ZmxRSLX4JqmSpKizo5BPa83dvT8Ql/hk = Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CFZl8SU8LIgm; Fri, 3 Apr 2015 15:21:55 +0200 (CEST) Received: from pd.tnic (p5DDC4C62.dip0.t-ipconnect.de [93.220.76.98]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CC1E7244943; Fri, 3 Apr 2015 15:21:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1428067315; bh=/bzx/wT6ABhq5/XM6RTxNj2AQ8sMaOP+dEh9IowywqM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding; b=Lnikg7tJBU1i4L7HEm9xd1f4rJXlJ8Y5PDVh2 wUtVlVcVhriAhqZDQPk4DyXBreE4B7Dn2cgTYsR4yrktjpm3hHG7Se+yLq8oSNUlCKd VnE1flmfIm3ZHcsbZbU+DC7RrtxYx73UKU0ZmxRSLX4JqmSpKizo5BPa83dvT8Ql/hk = Received: by pd.tnic (Postfix, from userid 1000) id A04ED1617DA; Fri, 3 Apr 2015 15:19:53 +0200 (CEST) From: Borislav Petkov To: LKML Cc: Kristen Carlson Accardi , "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Subject: [PATCH] cpufreq/intel_pstate: Fix an annoying !CONFIG_SMP warning Date: Fri, 3 Apr 2015 15:19:53 +0200 Message-Id: <1428067193-9608-1-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.3 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Borislav Petkov I keep seeing drivers/cpufreq/intel_pstate.c: In function ‘intel_pstate_init’: drivers/cpufreq/intel_pstate.c:1187:26: warning: initialization from incompatible pointer type struct cpuinfo_x86 *c = &boot_cpu_data; when doing randconfig builds. This is caused by the fact that when !CONFIG_SMP, asm/processor.h defines cpu_info to boot_cpu_data and the local variable struct cpu_defaults *cpu_info overshadows it leading to this unfortunate assignment in the preprocessed source: struct cpu_defaults *boot_cpu_data; struct cpuinfo_x86 *c = &boot_cpu_data; Rename the local variable and use static_cpu_has_safe() which alleviates the need for defining a local cpuinfo_x86 pointer. Signed-off-by: Borislav Petkov Cc: Kristen Carlson Accardi Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: linux-pm@vger.kernel.org Acked-by: Kristen Carlson Accardi --- drivers/cpufreq/intel_pstate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 872c5772c5d3..0b883f131a73 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -31,6 +31,7 @@ #include #include #include +#include #define BYT_RATIOS 0x66a #define BYT_VIDS 0x66b @@ -1183,8 +1184,7 @@ static int __init intel_pstate_init(void) { int cpu, rc = 0; const struct x86_cpu_id *id; - struct cpu_defaults *cpu_info; - struct cpuinfo_x86 *c = &boot_cpu_data; + struct cpu_defaults *cpu_def; if (no_load) return -ENODEV; @@ -1200,10 +1200,10 @@ static int __init intel_pstate_init(void) if (intel_pstate_platform_pwr_mgmt_exists()) return -ENODEV; - cpu_info = (struct cpu_defaults *)id->driver_data; + cpu_def = (struct cpu_defaults *)id->driver_data; - copy_pid_params(&cpu_info->pid_policy); - copy_cpu_funcs(&cpu_info->funcs); + copy_pid_params(&cpu_def->pid_policy); + copy_cpu_funcs(&cpu_def->funcs); if (intel_pstate_msrs_not_valid()) return -ENODEV; @@ -1214,7 +1214,7 @@ static int __init intel_pstate_init(void) if (!all_cpu_data) return -ENOMEM; - if (cpu_has(c,X86_FEATURE_HWP) && !no_hwp) + if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp) intel_pstate_hwp_enable(); if (!hwp_active && hwp_only)