From patchwork Thu May 29 08:15:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Daniel Kachhap X-Patchwork-Id: 31101 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 27B05203E6 for ; Thu, 29 May 2014 08:16:25 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kq14sf56793127pab.6 for ; Thu, 29 May 2014 01:16:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=6wpNS5atLBH+D4lioUyqoMlB5Xq3TEei5mORNwsg13Q=; b=XdJZRDMEksUYgh3ZksvlAwsSeaFjJEWR3SfaKKZgjwv2vXZpZXRzt1h+sRC68YN4Jq 6LUjByRt7vR37I5G1DRL4+hsCb3nvO51r3SZKNKwUY402pdEjc/IXIsWus5lOuGFSwL+ ETVo+pW1WjcoMIP3uIzOVx5nGw9vNO9CG2vGFcjQKt8L1JjbyRUferc8dQzj/G1Ur8jn QgZkD0vAPYqi3xVsWMDzTIhaptQIJpup4auj9eIh69YYJc0pyeMWb04I19G7r/AClUdb RmsB0f4KwFwpQQ/uH2HYdDH80IAvO8i0YP1ZGrfq/10mJkysQQwcClbfpW05T5F7L/bC lUOw== X-Gm-Message-State: ALoCoQnw7GWQWH7Ls6crMGhvlFTqWGtl4T1cN2Hc7J2DRMtgwpRu1ila/tURRdLO9y3w371vz2Vr X-Received: by 10.66.164.167 with SMTP id yr7mr2387144pab.15.1401351384079; Thu, 29 May 2014 01:16:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.97 with SMTP id g88ls460722qgf.40.gmail; Thu, 29 May 2014 01:16:23 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr5229340vcb.0.1401351383937; Thu, 29 May 2014 01:16:23 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id fw20si12663927vec.95.2014.05.29.01.16.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 01:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22e as permitted sender) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id jw12so13679861veb.5 for ; Thu, 29 May 2014 01:16:23 -0700 (PDT) X-Received: by 10.58.85.3 with SMTP id d3mr5096797vez.34.1401351383868; Thu, 29 May 2014 01:16:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp9476vcb; Thu, 29 May 2014 01:16:23 -0700 (PDT) X-Received: by 10.66.177.168 with SMTP id cr8mr6570666pac.128.1401351382932; Thu, 29 May 2014 01:16:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qs6si26980277pbc.21.2014.05.29.01.16.22; Thu, 29 May 2014 01:16:22 -0700 (PDT) Received-SPF: none (google.com: linux-acpi-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933620AbaE2IQR (ORCPT + 8 others); Thu, 29 May 2014 04:16:17 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:42607 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933476AbaE2IQO (ORCPT ); Thu, 29 May 2014 04:16:14 -0400 Received: by mail-pa0-f50.google.com with SMTP id fb1so12531241pad.9 for ; Thu, 29 May 2014 01:16:12 -0700 (PDT) X-Received: by 10.66.163.135 with SMTP id yi7mr6573493pab.150.1401351372848; Thu, 29 May 2014 01:16:12 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id ee5sm5006897pbc.47.2014.05.29.01.16.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 May 2014 01:16:12 -0700 (PDT) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Zhang Rui , linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, edubezval@gmail.com, rjw@rjwysocki.net, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Subject: [PATCH v1 5/6] thermal: thermal_core: Remove the max cooling limit check in registration Date: Thu, 29 May 2014 13:45:33 +0530 Message-Id: <1401351334-11210-6-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1401351334-11210-1-git-send-email-amit.daniel@samsung.com> References: <1401351334-11210-1-git-send-email-amit.daniel@samsung.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Original-Sender: amit.daniel@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22e as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This is required as with the addition of the cooling notifiers mechanism the client can enable some more cooling states at a later point of time and hence max cooling state is dynamic entity now. Say when minimum p state is reached then ACPI specific throttling is enabled which may add some more cooling states. Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/step_wise.c | 2 +- drivers/thermal/thermal_core.c | 9 +++------ include/linux/thermal.h | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index f251521..7d65617 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -72,7 +72,7 @@ static unsigned long get_target_state(struct thermal_instance *instance, } break; case THERMAL_TREND_RAISE_FULL: - if (throttle) + if (instance->upper != THERMAL_CSTATE_MAX && throttle) next_target = instance->upper; break; case THERMAL_TREND_DROPPING: diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 1a60f83..743bb83 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -923,7 +923,6 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, struct thermal_instance *pos; struct thermal_zone_device *pos1; struct thermal_cooling_device *pos2; - unsigned long max_state; int result; if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) @@ -941,13 +940,11 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, if (tz != pos1 || cdev != pos2) return -EINVAL; - cdev->ops->get_max_state(cdev, &max_state); - - /* lower default 0, upper default max_state */ + /* lower default 0, upper default THERMAL_CSTATE_MAX */ lower = lower == THERMAL_NO_LIMIT ? 0 : lower; - upper = upper == THERMAL_NO_LIMIT ? max_state : upper; + upper = upper == THERMAL_NO_LIMIT ? THERMAL_CSTATE_MAX : upper; - if (lower > upper || upper > max_state) + if (lower > upper) return -EINVAL; dev = diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 3fb1b92..6cfe8c8 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -36,6 +36,7 @@ /* invalid cooling state */ #define THERMAL_CSTATE_INVALID -1UL +#define THERMAL_CSTATE_MAX 1UL /* No upper/lower limit requirement */ #define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID