From patchwork Wed Jun 20 17:22:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10478069 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 13B8D60210 for ; Wed, 20 Jun 2018 17:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA07F28EB4 for ; Wed, 20 Jun 2018 17:24:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF9D28EEF; Wed, 20 Jun 2018 17:24:33 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 7C36728EB4 for ; Wed, 20 Jun 2018 17:24:33 +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=FxbTRCUD835Q3Mf/MMazMQQPbTQY/i9jN44rhnbLEws=; b=QvFn+3FxTS4yKrv1VjleELDr2X 63p1PJYf+xTpZUUiaP3S1etvl146m3WjLRPfzm/BU6V9GKDR+DwyC4ljyKCv9TmRJBqzFRCTh/Djy iETIiOEJiKAOVUCaZikaC1dZ4NktWyTb3p9hDw9e7QOFsMKyKh5bUiXWJTh/gNQohx/By/5IrZfjl ZjHFB8gwRXXHEDxYdRCuGxWi7fu9wgvWANrye1SHnEAZvov/NuY+za3o8zFEbW9LfvGjMJWyWMsRn aYtUvUni/QPSea33yJAAwLn7kKjwCDQNhJXn5OWYmky+PUm/eN1wauRUR4cxtwhc49VVjXPTf5DJ0 GkHRMKzQ==; 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 1fVgqF-0006Fv-IM; Wed, 20 Jun 2018 17:24:23 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVgoj-0005Uw-2Q for linux-arm-kernel@lists.infradead.org; Wed, 20 Jun 2018 17:22:52 +0000 Received: by mail-lf0-x244.google.com with SMTP id p23-v6so443783lfh.11 for ; Wed, 20 Jun 2018 10:22:38 -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=Ta+r1yNZdCXimBKhBsWVqn0620vMogcKiWR1qFWwX9o=; b=EF2bvCWY87O7+fzTccjACc8uQ+tS6c1h47qU0WCLNE9BXDGDpA92Y+fa8fUNP0zlAn e1WjcPxKWKGFzqbDnJ1+i7Td/Zun5dmHEFYKseWWNCltTJu/QpSgKmKyjEwsnVloN5Ed URm3HgPUxaZXrnYKuvDuBJW2EHSlMzaWcJp+0= 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=Ta+r1yNZdCXimBKhBsWVqn0620vMogcKiWR1qFWwX9o=; b=MiFsLti17DJQhNQ0m8H3dThkvWQc+tm30hnamQofSZB4OsEymC2jOJWb72bXyaeRS0 rGqha71EyVCpwYcTz6meF/q4pNmUK+yBC4S8VuPsuZx35D3uSHh0fSDR8c6rXw2WDwVF ++uCU2I67gFcyLPSsnGeHKwrPZyhszAnrzgljh9eb1kJUa9Onn1lodhwdlfwTqfDKLDD tjqJodQf43HO+ipn9NOdXmTV5as32lYKxY4Lk2kWP26uHslC5LlSVXKEOlr2gP0ro2cJ r9tqeVacnr6ZX68LRdp9LSf2fkSYA3OxpJNwlFua3u74r2I5gq11AofBkRHywecDxfWh ctLA== X-Gm-Message-State: APt69E1aajTxLSAdD/Hkw+zAk9ugrqGh1n8pi5iWrLCUSvAIdCRAUDP9 xa58ftIrYArUn72Ec01NcE6pEQ== X-Google-Smtp-Source: ADUXVKJyxlvSIFg+/7EwbEUN34YH+vPDjyjo+9LB6G2f5ADATsPe/le1yelWM3DGCZZIG5bc1+t24g== X-Received: by 2002:a2e:750d:: with SMTP id q13-v6mr14482924ljc.56.1529515357131; Wed, 20 Jun 2018 10:22:37 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:22:36 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Subject: [PATCH v8 01/26] PM / Domains: Don't treat zero found compatible idle states as an error Date: Wed, 20 Jun 2018 19:22:01 +0200 Message-Id: <20180620172226.15012-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_102249_123521_E9C6E479 X-CRM114-Status: GOOD ( 17.83 ) 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 Reviewed-by: Lina Iyer --- 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 4925af5c4cf0..62969c3d5d04 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2452,8 +2452,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) @@ -2462,8 +2462,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)