From patchwork Tue Dec 9 12:22:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 5462481 X-Patchwork-Delegate: rui.zhang@intel.com 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 73FBF9F1D4 for ; Tue, 9 Dec 2014 12:53:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F0B720166 for ; Tue, 9 Dec 2014 12:53:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1095200E5 for ; Tue, 9 Dec 2014 12:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756669AbaLIMxC (ORCPT ); Tue, 9 Dec 2014 07:53:02 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:44514 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756643AbaLIMxB (ORCPT ); Tue, 9 Dec 2014 07:53:01 -0500 X-Greylist: delayed 1855 seconds by postgrey-1.27 at vger.kernel.org; Tue, 09 Dec 2014 07:52:58 EST Received: from e105922-lin.cambridge.arm.com (e105922-lin.cambridge.arm.com [10.2.131.231]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with SMTP id sB9CLtb8025393; Tue, 9 Dec 2014 12:21:55 GMT Received: by e105922-lin.cambridge.arm.com (sSMTP sendmail emulation); Tue, 09 Dec 2014 12:22:09 +0000 From: Punit Agrawal To: edubezval@gmail.com Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Punit Agrawal Subject: [PATCH] thermal: Fix cdev registration with THERMAL_NO_LIMIT on 64bit Date: Tue, 9 Dec 2014 12:22:01 +0000 Message-Id: <1418127721-1182-1-git-send-email-punit.agrawal@arm.com> X-Mailer: git-send-email 2.1.1 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 size of unsigned long varies between 32 and 64 bit systems while the size of phandle arguments is always 32 bits per parameter. On 64-bit systems, cooling devices registered via of-thermal apis fail to bind when the min/max cooling state is specified as THERMAL_NO_LIMIT (-1UL) as there is a mis-match between the value read from the device tree (32bit) and the pre-processor define (64bit). As we're unlikely to need cooling states larger than 32 bits, and for consistency with the size of phandle arguments, explicitly limit THERMAL_NO_LIMIT to 32 bits. Signed-off-by: Punit Agrawal --- include/dt-bindings/thermal/thermal.h | 2 +- include/linux/thermal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dt-bindings/thermal/thermal.h b/include/dt-bindings/thermal/thermal.h index 59822a9..b5e6b00 100644 --- a/include/dt-bindings/thermal/thermal.h +++ b/include/dt-bindings/thermal/thermal.h @@ -11,7 +11,7 @@ #define _DT_BINDINGS_THERMAL_THERMAL_H /* On cooling devices upper and lower limits */ -#define THERMAL_NO_LIMIT (-1UL) +#define THERMAL_NO_LIMIT (~0) #endif diff --git a/include/linux/thermal.h b/include/linux/thermal.h index ef90838..005586f 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -38,7 +38,7 @@ #define THERMAL_CSTATE_INVALID -1UL /* No upper/lower limit requirement */ -#define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID +#define THERMAL_NO_LIMIT ((u32)~0) /* Unit conversion macros */ #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \