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 Kachhap X-Patchwork-Id: 4262841 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C2548BF90B for ; Thu, 29 May 2014 08:17:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB2B12012E for ; Thu, 29 May 2014 08:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E29812034A for ; Thu, 29 May 2014 08:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933619AbaE2IQR (ORCPT ); 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ItK9t7H3dIyQK7wGzL8d+Kbz89I/om3BtzQ9lYloQFc=; b=ddxSUGmJhyBiIqRadSIxTNtxf8QxO9vClVZp1QlDaRRSHekvrCDs/qMulkHTXWOF5Z U3R2skf5+Eq/Eeu1TTyrcAE2/JsWEyQFdsvUdPYn3dpQ9WriggTqIEub7IhYjb7RA43p 88SXv7yG5fHDPUrqRJUFKxCvUQTeLQ9e9pDcQDlYtumeVjcbBuBYrpqkAFnmQz4aJ0xZ 0lB8Lx0fC2ZNx/9cfL5iLf3AkudMwE5qGPwysOY7bjbGmLvLDzPbF1rMPIyClQrA81Yz FeuDp/O1vrFsBkj/Y/mo/LIl0f4iLDQG73Kys8+FggSYIDrIGDtVhTf0yMl+4lP9q1zs QTRQ== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 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