Message ID | 1459928655-6071-7-git-send-email-ray.huang@amd.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show
Return-Path: <linux-hwmon-owner@kernel.org> X-Original-To: patchwork-linux-hwmon@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 D7A4B9F39A for <patchwork-linux-hwmon@patchwork.kernel.org>; Wed, 6 Apr 2016 07:44:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0211C20212 for <patchwork-linux-hwmon@patchwork.kernel.org>; Wed, 6 Apr 2016 07:44:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E29520256 for <patchwork-linux-hwmon@patchwork.kernel.org>; Wed, 6 Apr 2016 07:44:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932120AbcDFHoZ (ORCPT <rfc822;patchwork-linux-hwmon@patchwork.kernel.org>); Wed, 6 Apr 2016 03:44:25 -0400 Received: from mail-by2on0099.outbound.protection.outlook.com ([207.46.100.99]:64544 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932112AbcDFHoV (ORCPT <rfc822;linux-hwmon@vger.kernel.org>); Wed, 6 Apr 2016 03:44:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wAjRBxkr1NE1TGouF+Hwe3AbjqZ/ZeuOEo9lQGjiFlo=; b=VKYvFgwvDXWAFpkMjfprw+E1tdsBch9oYDKjlOg17R4QwxCGQBdRraL2kX0VyDmMbqobpCaN03XSQJTK+vKD2fXgeXCO9SLsZ93YzQby6cQDp/8MQZaBQRSCSGr+MzsjEghc1FGPDGF7H/qQ3vuLKeluHI+Ui2rSnXDRUGRGfMY= Received: from DM3PR12CA0002.namprd12.prod.outlook.com (10.164.12.140) by BLUPR12MB0705.namprd12.prod.outlook.com (10.163.218.143) with Microsoft SMTP Server (TLS) id 15.1.447.15; Wed, 6 Apr 2016 07:44:13 +0000 Received: from CO1NAM03FT058.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::200) by DM3PR12CA0002.outlook.office365.com (2a01:111:e400:599f::12) with Microsoft SMTP Server (TLS) id 15.1.453.26 via Frontend Transport; Wed, 6 Apr 2016 07:44:13 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; alien8.de; dkim=none (message not signed) header.d=none; alien8.de; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by CO1NAM03FT058.mail.protection.outlook.com (10.152.81.107) with Microsoft SMTP Server id 15.1.453.6 via Frontend Transport; Wed, 6 Apr 2016 07:44:11 +0000 X-WSS-ID: 0O57C5L-07-35K-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2B681CAE7F4; Wed, 6 Apr 2016 03:44:08 -0400 (EDT) Received: from SATLEXCHOV01.amd.com (10.181.40.71) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 6 Apr 2016 02:44:42 -0500 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.266.1; Wed, 6 Apr 2016 02:44:06 -0500 Received: from hr-ub.amd.com (10.237.74.43) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.266.1; Wed, 6 Apr 2016 15:44:00 +0800 From: Huang Rui <ray.huang@amd.com> To: Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.de> CC: <linux-hwmon@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "Borislav Petkov" <bp@alien8.de>, Sherry Hurwitz <sherry.hurwitz@amd.com>, Huang Rui <ray.huang@amd.com> Subject: [PATCH v6 6/6] hwmon: (fam15h_power) Add platform check function Date: Wed, 6 Apr 2016 15:44:15 +0800 Message-ID: <1459928655-6071-7-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459928655-6071-1-git-send-email-ray.huang@amd.com> References: <1459928655-6071-1-git-send-email-ray.huang@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(4326007)(33646002)(189998001)(92566002)(1096002)(47776003)(586003)(106466001)(101416001)(19580395003)(19580405001)(50226001)(5003600100002)(229853001)(86362001)(2906002)(105586002)(53416004)(36756003)(5003940100001)(50466002)(48376002)(76176999)(77096005)(1220700001)(11100500001)(50986999)(81166005)(2950100001)(87936001)(5008740100001)(5001770100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0705; H:atltwp01.amd.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 3a1089c6-d866-46b2-7318-08d35def3ef7 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 2:6NHHsx19vO68nMCwiS528SfpqnNgiSvtgbFCHCadbgayO4PeLAbWh9wwJ3/40jW9oRek5OLQIzY0/o6MVNpxlqA9S+HQVhpoNHklAafFhaKqe+BiZGr+bIXCtRMoPdTwdMrcFgGCEI3JkxYmPkKfPjp6fpsVOch4ivuwiF9DedKqsJkjh9n4vgrDgqOXUkaE; 3:Mp6Ve+C5+NV5x/7fWAZ7gZhvtmwn8GwlF29LB59bc0MVLbiKdTUQpVDsLdo4oV+0g4al2Joea8vxbFFiOTVWZPP5vQ8zaO5ghTpGsOYOL+IHRZP+nAV/45x3ylaqoIaTvDbXMtEICSUyv3TE8INq17/02HLa+Ud5Uji0nnhSfDsx+umvYzldhrheHySU5iCQab18rm0THdVNS92JM5eKP9QisTtjo1u3Zl+jVCge+bk= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0705; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 25:SRCuIWOcssbQD6apZDNUNQliIZPZsrM8lxZOaouVPDrHrNXcWqPwQBt05/iJgatpGchUvFxV64wsqPSolD9zKJ4NSP91Uy1aQpIsrRAbgxfdi/99N6eAhq/Kvq0exBXGEHmMEfX1MsiaI2MHvaqHVJGuJyhjabkLpXpoocZvslPWaCW/REfrSXelq/7NNdLN2l3R+AsIMIpZrHjil5udm3nhbbAMGuxMB0OzX+04EVT7q+L2eM6hz0wuAcus8BeEhWYV0hqHOCpWNHyTeJe6O+Q3750RdGeqMU5OzNxlX2IVE7M8fD5remJR3RVTkKGmfKPSoVdnDkbCQjtV9BtdgT43Fb6jICzbwWIy3VOZMV9vHjhkBTRXOYymgLr24UiFiGmqlgsIhPeNLMPzhtfPWVVLDU0vI3IntsnT1O+Sb8X8Td2xTDBZQlKE3dTxaBVFQRXSgsE9Ke+mDf1cp+xeQjBvt3zMo4sR8FA/3mi0iXymc13m289S8ajI+Bu5rWgZKDdtcKl7WpmXeXWFyqMSYqyXailvV9gpVZX4wGw44t6eYav99o9y3RJGPxv59275nuooOAL+a0h6ddy0HsIa8gg8SfbBRzUtpvWl6fpjFLk= X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 20:jlu6qYFaJ6Dci2mZUu0Vdg3K3bbewzjV3N1cfO5RnMGApQdWhe1KYJjIeEVaW2TKI2PyJ5sDZRO6w5/kBhGashpmNf3r9AC1r1sSbCkkBJk0PZ5wSk23IGa+2X44dKVc/TKb77VBCx9bzAB96BitkE3yGZlqBXQFFQ/QLFfME7/DgCCqL+HL//GVhkIHyEqbMqdW3ApDi+W2QQAH5nQtGSpKr1qbfqTu6Q+L13yBdEcl0GsZInyggEud7NnCCakAA/EmMWhRMYjQgnY+yM6sh8Wmwm8WabbYjwSoCKj5PLbjsYEnxbJs6bW9MyoHlAKoRvweXLmtC/CV2HmU0YN8ddr+EYb/Ng9veIstASHKL7NZcBgaUHVjNyjgxARvMkTLsXhcQQbKrPTiIZiV9IEBL+3hCq3KiSJL+EybxlfKljV5Qb04pSqKku/USIxK2ljExJHhss/up1m7OmqHKCtvUvMXrf6FNOmJFL6s9wGwZn/k6E4CxFBSF/Cp0UvzQjhX X-Microsoft-Antispam-PRVS: <BLUPR12MB07059122C8D828502A5277B9EC9F0@BLUPR12MB0705.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13024025)(13017025)(13023025)(5005006)(13015025)(8121501046)(10201501046)(3002001); SRVR:BLUPR12MB0705; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0705; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 4:aPNqn+hOAGlCMwH3dPerhrFxD1/pbGvQE24x0yf+tQpvySHcIYBOFhjcj7J5trG5woety17P/e+WOYB1U80FQmz6xpnCJFX4s4Ar5AzBkTPtkA3LnkPDOjL9JgzwS7JbGfrrGOdm7+gwSvNLTYkF6eqjDwNjC2PmvS3ENTDa4BiBOxHDC6udy6smjHmyMGsx1nTTRY0+hGTB2TNnqz8mxzQK8ChlmSa5kRJCTMDRP42+7OQtRYwyuhGgFJdCOxj1dHfg1xY6XNmfzJAV4yGe2R+WbR8ybGX7WjLUmnFhK0tGCAGyYfQrUxHuYY2wj2J9J7ZfmroRo2Kdb42e+cL/x/+QocBVwXiIWrm9elB492T+eA7ZbwgbtGstJG02kwH50VKTZmWvFyl8Ak0S38Swo9b6dZgplu94rVrKRoW4TrbYmx8DXNDzW+HOSJe0n1iFcTc90yQnXgAiBriOj8jitg== X-Forefront-PRVS: 0904004ECB X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0705; 23:s4lAvsQHgBKSTSMtI9/d9PbiBSlwzfjPxnSIenxdy?= =?us-ascii?Q?+5fqsEWd84A4VFY0gNxJS58p1o5fkgrrwHNJYXRm0/v8eORRq2y8PJk8f3aV?= =?us-ascii?Q?u2A4nRKmcSsJjdOplHbpkwhinIFmBl6+4jEzHH8zEo/cI2zMvCC+zXCckmJx?= =?us-ascii?Q?ykV5scBUCEUnTYTFYCLTkD8mprC0hmtzwhyvw692NWLmdxHy1X3DoNpuCkam?= =?us-ascii?Q?vEk4wKeXArmVfUKNSaMs9IcxJmfGta2G6KTSL11d72hxOgunGUFTNJPZl7ke?= =?us-ascii?Q?ufgquJD8xxKidoIoSO+q+BXBUYHAuRNkJ3l9CEFeqWKJFV7P+Pq7vIWXSA1E?= =?us-ascii?Q?m+BMQ9DUc0yxLPQalHMI0vRhtbTOkrpzJsETDzd52HglkFR6DQ8pMtGAd3Is?= =?us-ascii?Q?9EriDlMb3GRLDbHndNsBW8MrViljKsy5lWusniqT63fPlHFCGfaXDG+HGSW3?= =?us-ascii?Q?asbOEr5d2yku20aiuzTtFNunutN0gcoi50/I/Acu7RRZK8H3LgYQ+DiFieik?= =?us-ascii?Q?nU8GxhgNdXR0aPmEXBjgj11PylLrP653JtyKE+YbNMOll5k6OQNYh1rR1S+j?= =?us-ascii?Q?8HKhZKGgZ7y9rubJNWlwU5QNOipga0iCR+xKNvF+1aK7Dop+1CES/zDMSU9z?= =?us-ascii?Q?f30iia8PwnyuRZ3+U2eUd7Mhr35LZaVX97a1XbMKnKOqR/Gd1HY6Ss+b86+9?= =?us-ascii?Q?VYI1MtDBh6dtpQyyMsZShYN1yxv3PVyQhuhyGccgGFObsWSSnvXFIpiIIBy6?= =?us-ascii?Q?i2tukMo05OOd1VRN16KEuLxFsxsunTCJkvRCaULr+IGlHEaFAg4y0xGg4Bve?= =?us-ascii?Q?hIuUnubuaLttU8FuZHMcE8XPOs4XhF+BWb/+7SNZjG1/yeBnVdtJ8IUXLnPb?= =?us-ascii?Q?WfxeZ76/eH60BBGWJv89HiuY/+jz3/iXKYE6+vP8DnYKEdFkUY+Fl63bK5L9?= =?us-ascii?Q?k+Dy3Zlk9iBL8nODmnPPHT5377NZf64XdwUt9rMzXFW6z+fXCb0KWBA27Iu1?= =?us-ascii?Q?nmTY+r/hXvQkTpOQZ6d6CKR?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0705; 5:Ak6wnI1cji87JWrOYYtvYabuI1Nfut2EOPkmnvB2NFJyRaFOFlcxyDgOjnEZFM1a8iuZvBToAc5IHO7vT4PCJLJSe9KXTiJjxewvDJWGs5qPinUL7BEeGCFzMThzqafQ5BiMuH6piP0/os9W6wGY1w==; 24:idjNt85S/gwHx4E3OCfuWyxXiKz2yfc5pPc7MogGYt6BjNSlfFWzrv830OqG8+YSiZcojj8P15mzuevCHQtLlsd/xalYiIR9I+BrjpGcWnc=; 20:GhlhtjE26KeMC1wMhIPU0FStWu4eBFDiDJUS9/ae9JaenDSPQ/IJsaiXZrtSixIYtcz0vo7EPNWLSVoqoCtBr8ykA4OruEMn6KswK2Wyl2EcQCF6v6TtSOR6Vlik7hGkXTq+25H6gh7Kno7IGxTULnWMDj/Pbbyejmhvj8ppZ0rw4pjIRxe1N7QX+oOTNS596pxI6LLmFvp4BFecP3wEk0AZOmUCtfF+1Gc8X8178kU5BhzmpWmVkBiAB2LvHTzL SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2016 07:44:11.7155 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0705 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: <linux-hwmon.vger.kernel.org> X-Mailing-List: linux-hwmon@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 7d9d697..eb97a92 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c @@ -78,6 +78,11 @@ struct fam15h_power_data { unsigned long power_period; }; +static bool is_carrizo_or_later(void) +{ + return boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model >= 0x60; +} + static ssize_t show_power(struct device *dev, struct device_attribute *attr, char *buf) { @@ -94,7 +99,7 @@ static ssize_t show_power(struct device *dev, * On Carrizo and later platforms, TdpRunAvgAccCap bit field * is extended to 4:31 from 4:25. */ - if (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model >= 0x60) { + if (is_carrizo_or_later()) { running_avg_capture = val >> 4; running_avg_capture = sign_extend32(running_avg_capture, 27); } else { @@ -111,7 +116,7 @@ static ssize_t show_power(struct device *dev, * On Carrizo and later platforms, ApmTdpLimit bit field * is extended to 16:31 from 16:28. */ - if (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model >= 0x60) + if (is_carrizo_or_later()) tdp_limit = val >> 16; else tdp_limit = (val >> 16) & 0x1fff;
This patch adds a platform check function to make code more readable. Signed-off-by: Huang Rui <ray.huang@amd.com> --- drivers/hwmon/fam15h_power.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)