From patchwork Fri Dec 14 10:15:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153807 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1881841ljp; Fri, 14 Dec 2018 02:15:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xpsb194YZb+mUc/WBXNDUVQqaZFvOHYjRn15IgWS/qK99RflB1Ig81HzpDTN4t2dPbG3k7 X-Received: by 2002:a62:5c41:: with SMTP id q62mr2283360pfb.171.1544782556453; Fri, 14 Dec 2018 02:15:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544782556; cv=none; d=google.com; s=arc-20160816; b=SwDrw+iksjxevoOiS0hLLD3byRmIYjIXafLqfCqnMDyTe9yYRpdwshrHXvabeCLpFp J4qdh7HenqnrT+ABiE/KM5RILCa2d536CSlO9ou86vezrb8PJTvU1nosTSjlYuuY4cGb HXPdXkdBY6tPep43QJmfbJSMrBHB/fNaeDx8nn1QcSKsdpOVy1lKN6g12RF92PBkBy1d pO/RhqrUuaOHbBrFvEpP+QgdUF3Mow5oSywX2U+HanQ8/g+vIcEnsJmga/nSImC0nmGT ox/b/DbuVXtReb3W5DNomxItsvXKR15v/5pymC0PfAV1jvx1+3UJ2WeYiSHdXF7UszrK jDKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xyjawys4UfIoyfyJqxfe5ExEUR+bqqWyP70n7MDXOvA=; b=INGMn1GLiXdrBA9eNiiifV0Zp7P6UqBd6xybYRLKzDK7rjTwm2FFIZm13VL7V6+tdk MWdGGaww97brbzxwnjJyi6JsF9TetNtUJ6SpDSajm0CaSUMv9KJR6KZvoyLGakSEonR7 LHFPX/DqgTN9AQPRgXwk8nOt/fk0IAWHOyRbLN3Wc1EZebomxwnGcmuHlIxQd7H7ARl9 fxK/SxzKwGcIOkN24F31umIsCJf3ZGCOmG09BuvHTX9KeeoKjOe8Uh205Tum5trmY6WR A9fNE1vDAggg8BsqbnjRJwbf8/PvtFa4C5RIU758taa5oU1lgOQL8uEAolkCk6rrOlzO FsfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=khDtGEfV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184si3729638pgj.329.2018.12.14.02.15.56; Fri, 14 Dec 2018 02:15:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=khDtGEfV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729600AbeLNKPy (ORCPT + 31 others); Fri, 14 Dec 2018 05:15:54 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40695 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729554AbeLNKPv (ORCPT ); Fri, 14 Dec 2018 05:15:51 -0500 Received: by mail-pf1-f196.google.com with SMTP id i12so2619742pfo.7 for ; Fri, 14 Dec 2018 02:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xyjawys4UfIoyfyJqxfe5ExEUR+bqqWyP70n7MDXOvA=; b=khDtGEfVB/sQdSXhCsKW1uxgppS0APiKDXcuRJvBpegeebjDiue+kswR4jYdpva13/ wGzp8Dvnkmt97N42PG3bc3VO+Tsuwol5McAJ/ACOsWIKWn49t37WATWrR1A1qyrB1fkE 1plqUL7bHf9qHgCAd/+gDA7bzi+UhVLxMULLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xyjawys4UfIoyfyJqxfe5ExEUR+bqqWyP70n7MDXOvA=; b=P4iBk1t1EfMv+mjB4oukUNVSDHy9BUeomq5sGU04vyniWu4ycf1SM2BfenbtnDJYmO qvbBFds+S46dV6eI0QllxdbL9msqsujw5mgGOTD3NhGfUddmfWnbjGc/T7MIsCRLHwfh 8WONizSU+l0zDnwZtkqy/S8LBwEkFBDrJqBE0bHM0y2XrRT3caVEQZkOI+/RY18fYvP0 Jnv/yhVU/6FW6N/t4C3BCcgTKB8xepkpN34AVFwzTiw6uqzn7y+cbkpo21Na7e+tLbto g+DeKg/mRzEUmDe2k2lCyMyEculL//Stdb0xWhZlp4549xcFv4+Q4OOiMGHJRSj0QcBX egiA== X-Gm-Message-State: AA+aEWasYxKgql/yfpO7p3l5ohSEBL+4p5kWacNGKVG5YK7fiolgRUyy JZbN5wZkEIHF2qJPgaW4gMlLfw== X-Received: by 2002:a62:a510:: with SMTP id v16mr2276882pfm.18.1544782550346; Fri, 14 Dec 2018 02:15:50 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id u87sm10663737pfi.2.2018.12.14.02.15.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 02:15:49 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , rnayak@codeaurora.org, niklas.cassel@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 4/7] OPP: Don't return 0 on error from of_get_required_opp_performance_state() Date: Fri, 14 Dec 2018 15:45:30 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_get_required_opp_performance_state() returns 0 on errors currently and a positive performance state otherwise. Since 0 is a valid performance state (representing off), it would be better if this routine returns negative values on error. That will also make it behave similar to dev_pm_opp_xlate_performance_state(), which also returns performance states and returns negative values on error. Change the return type of the function to "int" in order to return negative values. This doesn't have any users for now and so no other part of the kernel will be impacted with this change. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 10 +++++----- include/linux/pm_opp.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.19.1.568.g152ad8e3369a Reviewed-by: Ulf Hansson diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 8e57d257be77..68b512846d72 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -995,19 +995,19 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); * Returns the performance state of the OPP pointed out by the "required-opps" * property at @index in @np. * - * Return: Positive performance state on success, otherwise 0 on errors. + * Return: Zero or positive performance state on success, otherwise negative + * value on errors. */ -unsigned int of_get_required_opp_performance_state(struct device_node *np, - int index) +int of_get_required_opp_performance_state(struct device_node *np, int index) { struct dev_pm_opp *opp; struct device_node *required_np; struct opp_table *opp_table; - unsigned int pstate = 0; + int pstate = -EINVAL; required_np = of_parse_required_opp(np, index); if (!required_np) - return 0; + return -EINVAL; opp_table = _find_table_of_opp_np(required_np); if (IS_ERR(opp_table)) { diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 0b04c2093eb9..0a2a88e5a383 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -321,7 +321,7 @@ void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); -unsigned int of_get_required_opp_performance_state(struct device_node *np, int index); +int of_get_required_opp_performance_state(struct device_node *np, int index); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -360,9 +360,9 @@ static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) { return NULL; } -static inline unsigned int of_get_required_opp_performance_state(struct device_node *np, int index) +static inline int of_get_required_opp_performance_state(struct device_node *np, int index) { - return 0; + return -ENOTSUPP; } #endif