From patchwork Wed Mar 14 16:58:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10283223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 76BEF602C2 for ; Wed, 14 Mar 2018 18:15:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66A4028595 for ; Wed, 14 Mar 2018 18:15:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4152859E; Wed, 14 Mar 2018 18:15:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9DB628595 for ; Wed, 14 Mar 2018 18:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7fll4vo8CRjHwTNG8/EuBO4ZiDYwJNMK3//Ni4UBMPE=; b=L4Xlh8VsyVboiY2VBHh5Kluzb0 sYHgtMdOnMtOGrxb7pilCf8JmceRCkLNKtvvXa0Bvjlt3slkiTRaahJJPXj9vtKLe016nfYwTPiwu 26mvJ/jK8B9wBG7OsembNRCoK1q5H4mW7IwLyeg83PeswbFWdVkK+HENPWyIjmDi1lsCrjlxSAiPk KqfJFDnq9Ol5ZvL71NACILOFfTJ0UwuChh6ENySLtuaKqVQLYDRwyrWYT8ZROwWzSRtUeQDCpMDbC eTX6CH+50yCkuqDuPqIVQryFQsXW/XPe9c6Ct4BrZZu+4hLqDgVLQdxQB0VdCKSJlHnynSESbQmFL 2wB81Ysw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewAw3-0003o0-SN; Wed, 14 Mar 2018 18:15:35 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewAqi-00064J-EA for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Mar 2018 18:10:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=uiX6cVCYdVy2N/+7t+yBLdnoU BxIf1/zGAHKOembjCDH9BYF22T/ZG5nqznrywTa9WWtSCsO5U+LclNGNNL8HiCw9I6dX287ZRKPCh OcbmG62ESyDYJNkE+1lidFNyL7M+qvJJAv8hTC2l2WEvHLQ5g2iBtQ5aQadqnzg5EuAp39rnpLz+c V3OYxqJm4wYmxOLCMqx126Eh4M8CKqlOEYH84DkATkfLfaz1hjJNymFPdvC7zhtG7Uk8ptBTG/44n SYeu5r37uVrEmmTG3+N1ke1yq24EM1KynUCTFvYVIc/7mjUiExYoPVcIWzBsfnN4GPARoAq3ui+X0 eCT9/JVkw==; Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew9kE-0003Pe-N4 for linux-arm-kernel@lists.infradead.org; Wed, 14 Mar 2018 16:59:19 +0000 Received: by mail-lf0-x241.google.com with SMTP id x205-v6so5906292lfa.0 for ; Wed, 14 Mar 2018 09:59:06 -0700 (PDT) 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; bh=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=VmtvPYm3ZVkInfG6i5xbFtKCRH4INgwWQGX1yVKFjsPcf/Q+EZY7x5k6EAaLyesW9K MOWYc7hrV0xpM2zKNdlj9jNjlpB+e9DJobq8hdhbe1SZ3bB6LYA/dd7RBXszndDQ2BBq pbbWKr2wfXXQH9u6tJ8nCmOHUVCX9DAlHx20Y= 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; bh=XHPVBb922TA1uGb222Hxlm4AdEoDZBjgQ2Eka3bpJ8w=; b=cCXPK/f67npGzoj7Qxgjzo6av7DkQ2Nym1SillTS4zyO05pspImIu3RwLo5CWnWCwt +q8V7qlvGJwz8Iie6IMTZLX65j5ATqGabIpdzHjnxVPZOQD4oOorJB+XI9hMq8mPEAcy h/CqY7WcD1xnM6TmwrQX1gSh62Z7VNCqcWXXtKsxxrzoHexBaW+tLtgPlJoT2ZE3h7m8 FQpE5A64BPybxV0PpRn1noAT8t4GPb2bhbdHplsUTWrxkR9li8fVeYaOb3+vBvG4syw+ V8FGtZEv3dERJ3SbRQ9LPh7PnGn9sLVA/fCGwsw/DTZ2EIP7QmuN+eYws1B3EOtgjpu5 QFcA== X-Gm-Message-State: AElRT7FzOEnD1cLHDGe/wZaHSnYXPlVFcPjBq1EAkKz8RJCRmhDp7QHi rIfNLxnpKGiT73qVbAbsQ7hxsA== X-Google-Smtp-Source: AG47ELs3eF+sBpGB/98M1eL8koIYYSgfJ8k9SzJ/PsYUCz/rGNZvzdFkTJJ6vff7P+ksq/Ou7ZusOg== X-Received: by 2002:a19:2ad5:: with SMTP id q82-v6mr3886353lfq.79.1521046743907; Wed, 14 Mar 2018 09:59:03 -0700 (PDT) Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:03 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Subject: [PATCH v6 01/25] PM / Domains: Don't treat zero found compatible idle states as an error Date: Wed, 14 Mar 2018 17:58:11 +0100 Message-Id: <1521046715-30683-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180314_125918_764177_56CE42A9 X-CRM114-Status: GOOD ( 18.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Juri Lelli , Geert Uytterhoeven , Kevin Hilman , Stephen Boyd , linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of returning -EINVAL from of_genpd_parse_idle_states() in case none compatible states was found, let's return 0 to indicate success. Assign also the out-parameter *states to NULL and *n to 0, to indicate to the caller that zero states have been found/allocated. This enables the caller of of_genpd_parse_idle_states() to easier act on the returned error code. Cc: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 1ea0e25..c2ef944 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2331,8 +2331,8 @@ static int genpd_iterate_idle_states(struct device_node *dn, * * Returns the device states parsed from the OF node. The memory for the states * is allocated by this function and is the responsibility of the caller to - * free the memory after use. If no domain idle states is found it returns - * -EINVAL and in case of errors, a negative error code. + * free the memory after use. If any or zero compatible domain idle states is + * found it returns 0 and in case of errors, a negative error code is returned. */ int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n) @@ -2341,8 +2341,14 @@ int of_genpd_parse_idle_states(struct device_node *dn, int ret; ret = genpd_iterate_idle_states(dn, NULL); - if (ret <= 0) - return ret < 0 ? ret : -EINVAL; + if (ret < 0) + return ret; + + if (!ret) { + *states = NULL; + *n = 0; + return 0; + } st = kcalloc(ret, sizeof(*st), GFP_KERNEL); if (!st)