From patchwork Thu May 7 04:29:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Ni X-Patchwork-Id: 6353611 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2AA19BEEE1 for ; Thu, 7 May 2015 04:30:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F27622034E for ; Thu, 7 May 2015 04:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66A1C20274 for ; Thu, 7 May 2015 04:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbbEGE3R (ORCPT ); Thu, 7 May 2015 00:29:17 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:17775 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbbEGE3R (ORCPT ); Thu, 7 May 2015 00:29:17 -0400 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Wed, 06 May 2015 21:28:34 -0700 Received: from HQMAIL104.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 06 May 2015 21:27:17 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 06 May 2015 21:27:17 -0700 Received: from HKMAIL101.nvidia.com (10.18.16.10) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 7 May 2015 04:29:15 +0000 Received: from niwei-dev.nvidia.com (10.19.224.106) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 7 May 2015 04:29:12 +0000 From: Wei Ni To: , CC: , Wei Ni Subject: [PATCH] thermal: of: fix cooling_spec.args for 64bit Date: Thu, 7 May 2015 12:29:12 +0800 Message-ID: <1430972952-16303-1-git-send-email-wni@nvidia.com> X-Mailer: git-send-email 1.9.1 X-NVConfidentiality: public MIME-Version: 1.0 X-Originating-IP: [10.19.224.106] X-ClientProxiedBy: DRBGMAIL101.nvidia.com (10.18.16.20) To HKMAIL101.nvidia.com (10.18.16.10) 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 The THERMAL_NO_LIMIT is defined as -1UL, when it is set in DT, the of-thermal will use of_parse_phandle_with_args() to parse it. Since the args is uint32_t, so in 32bit system, the of framework will read it as 0xffffffff, it's the expected value "-1". But in 64bit system, this value is read as 0x00000000ffffffff, it's not a negative value, it will cause problems. This change can fix this issue. Signed-off-by: Wei Ni --- drivers/thermal/of-thermal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 9e8c614103ef..8d6b4070dea3 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -613,8 +613,10 @@ static int thermal_of_populate_bind_params(struct device_node *np, } __tbp->cooling_device = cooling_spec.np; if (cooling_spec.args_count >= 2) { /* at least min and max */ - __tbp->min = cooling_spec.args[0]; - __tbp->max = cooling_spec.args[1]; + __tbp->min = cooling_spec.args[0] == -1U ? + THERMAL_NO_LIMIT : cooling_spec.args[0]; + __tbp->max = cooling_spec.args[1] == -1U ? + THERMAL_NO_LIMIT : cooling_spec.args[1]; } else { pr_err("wrong reference to cooling device, missing limits\n"); }