Received: by 10.192.165.156 with SMTP id m28csp908207imm; Mon, 16 Apr 2018 10:36:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/N0KvSmdB2sJSylKP34NF4DqRX/DgBmFBoGddWSxXc/ZGAnnni7TKqWMM7jr8TirRsYIFP X-Received: by 10.167.134.80 with SMTP id a16mr22544531pfo.172.1523900183822; Mon, 16 Apr 2018 10:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523900183; cv=none; d=google.com; s=arc-20160816; b=Dw8sBMyntRX1E422sDrCBJRoUs2ys8AcncgyW7HjQ20IfB558BEQbsoDO9l+eTGcuL tq5xR728qApIO4Cu12R45ht++rfzEQtxLTbucuUzJq3mW80NVydXRf0KKs8ORGbZZ41A UGQEhbbpVg8ZuifUGb1oPROa01VoGwmHng1YFJEyeWCoi7iLF6x285VtaTRY5g28cDjp IhUy4FMCZ+hBomNEjB1NpBrz6i4URM9+xvzJo4j6GtBsmicyjz9cu+SsWXjySLmL7VzB dEG9ydFOiP+T7LI5IkShHqe0p35lK4V3EIlvuByi7hOpdLXJ7Lu130QjSpRVa2ieMalH okFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=objSIVWSr69oKM7uisLETMw0j3x+3TLdimOE5aqfsPI=; b=cL66FBa9GKczu1GCVifybjViwWGRgPuk48O59nJLDNMvDdQurejkEFT+H37pQ2XbdO EeTBR4qi7guk+lJBmNbDr5ks54DPfzNP0iPlbYhqyyClu6SoMMusn29QnilbIG2NitTP Hi3Wo1xx/r9yePlTTPFi/jbbLr5qMtlO6Im89t+1ODiL5iLvFF7mFqJ999WfuSUlC55u WorcViBWyiG+UYUcnfKEtjVD9P63pG58nOP9BQEsjQrOhEYrwKC47xtAu+P2BohadUhs n7Z4Y4aFFtcZAxhcuZjp2tJWy2d8Bz7K8Vokyr9pjSG988KLOP+ReyRFLWj5siGtlWj/ zdDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=T7gJpqap; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q/jJDXN/; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si9991566pgf.249.2018.04.16.10.36.02; Mon, 16 Apr 2018 10:36:23 -0700 (PDT) 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=@codeaurora.org header.s=default header.b=T7gJpqap; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q/jJDXN/; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752955AbeDPRdd (ORCPT + 99 others); Mon, 16 Apr 2018 13:33:33 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35420 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbeDPRd3 (ORCPT ); Mon, 16 Apr 2018 13:33:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A595560F6E; Mon, 16 Apr 2018 17:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523900008; bh=JeYgDFK9SxCzzSCajTqz9rai1tRJQaJOHEV/Oz9DmTg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T7gJpqap1rP0Ko5rdkqOobQJanW+cc00cnQ/fuVheB4UUzmmGBcv+feTbGFlGL/63 +RnjCe0N0KrwWnck86AqETHffwkP82mr3puSbkSVKz45SLRRX4naerEA6OWJhbJrH1 918vpy+eDlb4+DWkqXnCs85K6y3ziTVj0oDrVcQ0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 65E7260290; Mon, 16 Apr 2018 17:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523900007; bh=JeYgDFK9SxCzzSCajTqz9rai1tRJQaJOHEV/Oz9DmTg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q/jJDXN/KiZu7C7vLQEf67RPi0uxjrGseQp+kKr65eV2rFk4qEEbT+YUeLDYRWMXR Xi0aAyQnlscSQ3Wpypa8RMtCXCmxi/J3TKt1nYbFkN/+3G53vQxlR7y/rDyx7SKxll Qxz5FNH1JItqTzrX61SUgbKUVNgJUcvZQvHqqWnU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 65E7260290 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Mon, 16 Apr 2018 11:33:26 -0600 From: Lina Iyer To: Ulf Hansson Cc: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org, Kevin Hilman , Lina Iyer , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 01/26] PM / Domains: Don't treat zero found compatible idle states as an error Message-ID: <20180416173326.GD1209@codeaurora.org> References: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> <1523531671-27491-2-git-send-email-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1523531671-27491-2-git-send-email-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 12 2018 at 05:14 -0600, Ulf Hansson wrote: >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 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) >-- >2.7.4 >