Received: by 10.213.65.68 with SMTP id h4csp437425imn; Fri, 30 Mar 2018 08:20:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+eFIBIiCDAttSszxwAKuVML6EbPUCXgEXUx0iW+BDSpau/TWvXYWf6aFB5w3sRh/xnovRp X-Received: by 2002:a17:902:8f97:: with SMTP id z23-v6mr13446224plo.162.1522423250007; Fri, 30 Mar 2018 08:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522423249; cv=none; d=google.com; s=arc-20160816; b=kDBpMiFfsD2HR3gQkIIwgWjOg8jYCxD6axxwPHWaRD1DP2NZaoIargCo+J738SBVmn Rc3AcTBdnDlBySu7/Pm1dLNIEwApxvcEOnlxegNOESJEQsdhgNC4JrYNqjbdhMcg8zUj bKvStiCA5eTiSzgBoTgbrN+9yC/Dy//wFZ4dKLG9fROdXYKKCBeAa3bH2vL2eUnrvwHS uY+r1IWcEmkzXakJaVHKavo/BIbPIylmVGSW7kyvyarbkuW9GnAXKvVzTbA2oelRbhWZ 9bn8IG/65jBnkQ3J3V12Rlr8ek2oJEfOck0Vnbxeq+EiC/3jcCzsg1YZPOCpRkulHWrf 9fKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=f3XhtKplFk09ldCwLSv+84+8xMJ5G5+i5LywiL6u+IE=; b=cFKAwDe1wbCTFZ6k7JhJj+kFQpK+xykJxZ4pYjp71salYFqOsiBhB/5JBJOcAGwpuX Xqr8vne5CL5/QA0lnuum8blpaHDaaYtwLd0MwKoy8DCxZ6L2X9jr3iJCeiAGvwIKgjcY tKRpI9AXAGaRi3V7bekRnz8XBZX+29nFXkbhWB05UdagD0xfI/egFNEzBlJE9ERUUz36 TVSYERxoISPYJ50Reg4+3VekiDkYiwGC8sp0gLUErKQhHhl2ANWergEhE+W+yF/3kJuK M7jKJVgwT/TH6dWmKhzoVJcgCq7lKXlbc5X9F1ucSKXSSslrPqsbpV6HyMBylR6+uOiG qnog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=p6SUrIZw; 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 l18si3563351pgn.744.2018.03.30.08.20.36; Fri, 30 Mar 2018 08:20:49 -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=fail header.i=@gmail.com header.s=20161025 header.b=p6SUrIZw; 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 S1752286AbeC3PTE (ORCPT + 99 others); Fri, 30 Mar 2018 11:19:04 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:43792 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbeC3PTC (ORCPT ); Fri, 30 Mar 2018 11:19:02 -0400 Received: by mail-pf0-f194.google.com with SMTP id j2so5562593pff.10; Fri, 30 Mar 2018 08:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=f3XhtKplFk09ldCwLSv+84+8xMJ5G5+i5LywiL6u+IE=; b=p6SUrIZwUq2A6BJPHn9BzcxCN7knEPwyUu4eQ5whm7D8sWpBP5Xm0VcjmZHBN9slmT U8c4x4HJKVjWzyP+RydvdY+40zyK89/Zi+m7YdYSX0mvhL3Tfntp3aikUb3dD37z9DF0 mCZ8irmnWOePHxGcMzlLm3FZ0O8QTY9CI2D8zslTSxaj+cBTdQzsJ741Z3R+7hqvFk7h ZWzZLiINChOI606WOLtcpgK8xgM3j4wDmr+DYu1bqMJAOhtW58XggAo7KMF8qVWKrFA0 b3XJHMAk4kWNg1Ud6AlnEOeUkY5wyCn/RSNzFe0yoIudg9q8A5x2eMN1xOeEVWptL84w IO2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=f3XhtKplFk09ldCwLSv+84+8xMJ5G5+i5LywiL6u+IE=; b=P5Pifmv97XxFwI01T9taHzYDFZ5d1ZY8n9It1hiACUzSb3Skoaw2Gp5aRY8ZHe0fQ+ LuHU8Pvuav5QWboM97mTvxc+jkq04jqQMVVb7hqRwWWHA9QK3/nxEUcUYKoP/1yme5ND 6p6TDQ7g1xh+beeFc0RNrltodqzfyckFZR0GRxMEvxAtvC1T7DWj/vdETu8k0eRw2L+h vgQegmYJhYoB0fWsMTh4A1XkinODfm6ULM/+rqScBGcNAtdXUrvVHUv9sm8aI2ZIGS+g yra0Rzxyhi5j7XWpJ7Y+OlOlfPveiTgn1pO60YpMTVIYPQJJsWinK9iXK4QkrMK/wZdk LNdg== X-Gm-Message-State: AElRT7ERAy+26+P24kvSJPCJlPoF5+/oc7SGENNI+p8Ispq9StuANxbZ 8d3XtVzaE2lTH/l4O6HOu94= X-Received: by 2002:a17:902:8482:: with SMTP id c2-v6mr2366625plo.295.1522421742880; Fri, 30 Mar 2018 07:55:42 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id f82sm20112015pfd.175.2018.03.30.07.55.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Mar 2018 07:55:41 -0700 (PDT) Date: Fri, 30 Mar 2018 07:55:40 -0700 From: Guenter Roeck To: davidwang Cc: jdelvare@suse.com, tglx@linutronix.de, mingo@redhat.com, rafel.j.wysocki@intel.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, brucechang@via-alliance.com, cooperyan@zhaoxin.com, qiyuanwang@zhaoxin.com, benjaminpan@viatech.com, lukelin@viacpu.com, timguo@zhaoxin.com Subject: Re: [v3] hwmon, via-cputem: support new centaur CPUs Message-ID: <20180330145540.GA13899@roeck-us.net> References: <1522371888-30013-1-git-send-email-davidwang@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522371888-30013-1-git-send-email-davidwang@zhaoxin.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 30, 2018 at 09:04:48AM +0800, davidwang wrote: > New centaur CPUs(Familiy == 7) also support this cpu temperature sensor. > > Change from v2 to v3: > *replace "goto" with "if...else.." according to suggestion from Guenter > > Change from v1 to v2: > *fixed the wrong if condition in patch v1. > > Signed-off-by: David Wang Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/via-cputemp.c | 31 ++++++++++++++++++------------- > 1 file changed, 18 insertions(+), 13 deletions(-) > > diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c > index 07a0cb0..0e81f28 100644 > --- a/drivers/hwmon/via-cputemp.c > +++ b/drivers/hwmon/via-cputemp.c > @@ -136,20 +136,24 @@ static int via_cputemp_probe(struct platform_device *pdev) > data->id = pdev->id; > data->name = "via_cputemp"; > > - switch (c->x86_model) { > - case 0xA: > - /* C7 A */ > - case 0xD: > - /* C7 D */ > - data->msr_temp = 0x1169; > - data->msr_vid = 0x198; > - break; > - case 0xF: > - /* Nano */ > + if (c->x86 == 7) { > data->msr_temp = 0x1423; > - break; > - default: > - return -ENODEV; > + } else { > + switch (c->x86_model) { > + case 0xA: > + /* C7 A */ > + case 0xD: > + /* C7 D */ > + data->msr_temp = 0x1169; > + data->msr_vid = 0x198; > + break; > + case 0xF: > + /* Nano */ > + data->msr_temp = 0x1423; > + break; > + default: > + return -ENODEV; > + } > } > > /* test if we can access the TEMPERATURE MSR */ > @@ -283,6 +287,7 @@ static int via_cputemp_down_prep(unsigned int cpu) > { X86_VENDOR_CENTAUR, 6, 0xa, }, /* C7 A */ > { X86_VENDOR_CENTAUR, 6, 0xd, }, /* C7 D */ > { X86_VENDOR_CENTAUR, 6, 0xf, }, /* Nano */ > + { X86_VENDOR_CENTAUR, 7, X86_MODEL_ANY, }, > {} > }; > MODULE_DEVICE_TABLE(x86cpu, cputemp_ids);