From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DFAFC74A52 for ; Thu, 11 Jul 2019 12:58:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D09C32166E for ; Thu, 11 Jul 2019 12:58:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OgaSn6Mc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728479AbfGKM6D (ORCPT ); Thu, 11 Jul 2019 08:58:03 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38822 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfGKM6C (ORCPT ); Thu, 11 Jul 2019 08:58:02 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190711125800euoutp0158a3f8afa29e26284681a7baf888e11c~wW6_n8iqW1548915489euoutp01e for ; Thu, 11 Jul 2019 12:58:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190711125800euoutp0158a3f8afa29e26284681a7baf888e11c~wW6_n8iqW1548915489euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1562849880; bh=vU9qDdY1dDbJlzQ9n1GbwihwW2hQxnIb8uEXqej1M0w=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=OgaSn6McuxgFj/ZbUKd5QfPd0NJAUGPGKUO+WkU/7vqTu0zOPxxQ4s2hEm1x0Nag3 nL+I8x0ztc68T7AhePCqkNhKwTe/ajJzsTQsyptLVPevNtG3jclZdAHdvXEHURzDHS mi3zRs0Hta5ya2n7H1lplC54MUMK8DrYiXWBYr34= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190711125759eucas1p1eb80c893d814e311caf62e05af60d236~wW693jgVi2653926539eucas1p1W; Thu, 11 Jul 2019 12:57:59 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 37.05.04298.752372D5; Thu, 11 Jul 2019 13:57:59 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190711125758eucas1p2726d34fa165f6645a51acd9f5b74ee68~wW69CUW4d2688026880eucas1p2j; Thu, 11 Jul 2019 12:57:58 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190711125758eusmtrp11e5293de3383f2e2615ebddb8ffe54ec~wW680Bw2Z2705327053eusmtrp1A; Thu, 11 Jul 2019 12:57:58 +0000 (GMT) X-AuditID: cbfec7f2-f13ff700000010ca-d6-5d2732576105 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6B.04.04140.652372D5; Thu, 11 Jul 2019 13:57:58 +0100 (BST) Received: from [106.120.51.18] (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190711125757eusmtip2f5b45b481281385eea833ffcf9a8fdf9~wW68Aeypy2342723427eusmtip2T; Thu, 11 Jul 2019 12:57:57 +0000 (GMT) Subject: Re: [PATCH 1/3] opp: core: add regulators enable and disable To: Viresh Kumar Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Chanwoo Choi , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Mark Rutland , MyungJoo Ham , Nishanth Menon , Rob Herring , Stephen Boyd , Viresh Kumar , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org From: Kamil Konieczny Message-ID: Date: Thu, 11 Jul 2019 14:58:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUzMcRzHfe/3WHP27efUZxjb0YxNYTbfloXNwzF/mM3DWOXST6Gr3K8o bPIYt0rY6E4qG2qhuuvJGsfqdLjU0iPC9WBE56mHFRZ+/Zj+e33fn/d7n/dn+/KU8JaZyu+O TRCNsfoYLetNV9SONMzfsmhO6ILXdf7EmlXMkLaBdwzJddQz5Gz3R4o0NJRw5OmxPo7YulsZ 0lSVzZL+dAciWQ12FbnteMWR622NKvLyaAFL+oafqsjJew6OjLZaaWId1JFSdy27XNDdyrmF dLbCM6yuo/Uuqyu9dkSXUVaIdM72SpWu3zZjA7fNe2mkGLN7v2gMDNnhHf3Aszbe7JPU1OKb gobUJuTFA14MtzvKOBPy5gVcgKDl03VWHgh4AEF282qF+xEcL4J/gRFTClIC+Qgyb9hVysOD wPXwPpJdk/EqaMnNp0yI5zV4HvQ+F2UPhUdoKGmycrKHxUugq7JOJbMar4YvXb1I9tPYH8o8 YbI8BW+FJ44cWrH4wGNzzxh74SCoyCoYi1LYD1705P7lmVDpyabkXYDTeRg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cm55bbKRXnJhbXJqXrpecn7uJERjt24793LKDsetd8CFGAQ5GJR7egIeqsUKs iWXFlbmHGCU4mJVEePe5K8cK8aYkVlalFuXHF5XmpBYfYjQF+m0is5Rocj4wEeWVxBuaGppb WBqaG5sbm1koifN2CByMERJITyxJzU5NLUgtgulj4uCUamBM5jykK5VVkS2+NzU0cFbOogyP tRfvPz9fVHWnOkbgZGGn0QIz3xmFNbyRNq9zzhmF5tv9+sr+TO/Yf6/A9Tc3+NRzufz1KbDk z1D+NU2C/3fygk1F8/JZes3L7m6fwyxtbR6hrnt91We59JfT+hz/ipU/47y7uT42x0vw5fkf l7Me+hyWuKvEUpyRaKjFXFScCADk5HCkDAMAAA== X-CMS-MailID: 20190711125758eucas1p2726d34fa165f6645a51acd9f5b74ee68 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190708141159eucas1p1751506975ff96a436e14940916623722 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190708141159eucas1p1751506975ff96a436e14940916623722 References: <20190708141140.24379-1-k.konieczny@partner.samsung.com> <20190708141140.24379-2-k.konieczny@partner.samsung.com> <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.07.2019 08:22, Viresh Kumar wrote: > On 08-07-19, 16:11, k.konieczny@partner.samsung.com wrote: >> From: Kamil Konieczny >> >> Add enable regulators to dev_pm_opp_set_regulators() and disable >> regulators to dev_pm_opp_put_regulators(). This prepares for >> converting exynos-bus devfreq driver to use dev_pm_opp_set_rate(). >> >> Signed-off-by: Kamil Konieczny >> --- >> drivers/opp/core.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 0e7703fe733f..947cac452854 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, >> if (ret) >> goto free_regulators; >> >> + for (i = 0; i < opp_table->regulator_count; i++) { >> + ret = regulator_enable(opp_table->regulators[i]); >> + if (ret < 0) >> + goto disable; >> + } > > What about doing this in the same loop of regulator_get_optional() ? yes, this is good, it will simplify code >> + >> return opp_table; >> >> +disable: >> + while (i != 0) >> + regulator_disable(opp_table->regulators[--i]); >> + >> + i = opp_table->regulator_count; > > You also need to call _free_set_opp_data() here. good catch if I move enable in loop above, then this will not be needed >> free_regulators: >> while (i != 0) >> regulator_put(opp_table->regulators[--i]); >> @@ -1609,6 +1620,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) >> >> /* Make sure there are no concurrent readers while updating opp_table */ >> WARN_ON(!list_empty(&opp_table->opp_list)); > > Preserve the blank line here. > >> + for (i = opp_table->regulator_count - 1; i >= 0; i--) >> + regulator_disable(opp_table->regulators[i]); >> >> for (i = opp_table->regulator_count - 1; i >= 0; i--) >> regulator_put(opp_table->regulators[i]); > > Only single loop should be sufficient for this. you are right, I will do this in single loop I will send v2 -- Best regards, Kamil Konieczny Samsung R&D Institute Poland From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kamil Konieczny Subject: Re: [PATCH 1/3] opp: core: add regulators enable and disable Date: Thu, 11 Jul 2019 14:58:02 +0200 Message-ID: References: <20190708141140.24379-1-k.konieczny@partner.samsung.com> <20190708141140.24379-2-k.konieczny@partner.samsung.com> <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Viresh Kumar Cc: Mark Rutland , Nishanth Menon , linux-samsung-soc@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Bartlomiej Zolnierkiewicz , Stephen Boyd , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Chanwoo Choi , Kyungmin Park , Kukjin Kim , MyungJoo Ham , devicetree@vger.kernel.org, Marek Szyprowski List-Id: devicetree@vger.kernel.org On 11.07.2019 08:22, Viresh Kumar wrote: > On 08-07-19, 16:11, k.konieczny@partner.samsung.com wrote: >> From: Kamil Konieczny >> >> Add enable regulators to dev_pm_opp_set_regulators() and disable >> regulators to dev_pm_opp_put_regulators(). This prepares for >> converting exynos-bus devfreq driver to use dev_pm_opp_set_rate(). >> >> Signed-off-by: Kamil Konieczny >> --- >> drivers/opp/core.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 0e7703fe733f..947cac452854 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, >> if (ret) >> goto free_regulators; >> >> + for (i = 0; i < opp_table->regulator_count; i++) { >> + ret = regulator_enable(opp_table->regulators[i]); >> + if (ret < 0) >> + goto disable; >> + } > > What about doing this in the same loop of regulator_get_optional() ? yes, this is good, it will simplify code >> + >> return opp_table; >> >> +disable: >> + while (i != 0) >> + regulator_disable(opp_table->regulators[--i]); >> + >> + i = opp_table->regulator_count; > > You also need to call _free_set_opp_data() here. good catch if I move enable in loop above, then this will not be needed >> free_regulators: >> while (i != 0) >> regulator_put(opp_table->regulators[--i]); >> @@ -1609,6 +1620,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) >> >> /* Make sure there are no concurrent readers while updating opp_table */ >> WARN_ON(!list_empty(&opp_table->opp_list)); > > Preserve the blank line here. > >> + for (i = opp_table->regulator_count - 1; i >= 0; i--) >> + regulator_disable(opp_table->regulators[i]); >> >> for (i = opp_table->regulator_count - 1; i >= 0; i--) >> regulator_put(opp_table->regulators[i]); > > Only single loop should be sufficient for this. you are right, I will do this in single loop I will send v2 -- Best regards, Kamil Konieczny Samsung R&D Institute Poland From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D73C74A35 for ; Thu, 11 Jul 2019 12:58:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7745921019 for ; Thu, 11 Jul 2019 12:58:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JrYkPN5u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OgaSn6Mc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7745921019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=partner.samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To:MIME-Version: Date:Message-ID:From:To:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UIOl55KUHpdsalOFvLvwt6zKIuCNx0dQPj2UTC9DeHo=; b=JrYkPN5uqMUiAZ y0sOnxfrEywFYug/Wq6D1Do5D7ngt/Kf9Th6XxYCewPf0gN5JyOMwj9E3rWP2YiMOndBJgpFkprP0 VxGa9fPIqdAbPpnpr0DOPtTq8+iCmnEUJYFeDhMDvMkLQwfIqDcRPGlSmdGvaN/jTrZsb/W+OsPMF YF8UEy+nuHSjmQz/UsX6tDe+5XqCerM1pvrBbdZh2h6QY5qRgfC5IlBQ1x12GsOHFfeNT45I1Hsy6 N3IlHWqnttg4/8pym3CLHVIRXCw99E0lBo6TtcZbyZ/yavlUO9DCGIOUedcjVi5Aw00tK2UClTSII 1UCrEANxaWpeBlxPqaLg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlYeH-00014Y-GZ; Thu, 11 Jul 2019 12:58:09 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlYeD-00013Z-T0 for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2019 12:58:07 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190711125800euoutp01828740e0289a689a971bccc7586ff02b~wW6_nij1w1548715487euoutp01d for ; Thu, 11 Jul 2019 12:58:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190711125800euoutp01828740e0289a689a971bccc7586ff02b~wW6_nij1w1548715487euoutp01d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1562849880; bh=vU9qDdY1dDbJlzQ9n1GbwihwW2hQxnIb8uEXqej1M0w=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=OgaSn6McuxgFj/ZbUKd5QfPd0NJAUGPGKUO+WkU/7vqTu0zOPxxQ4s2hEm1x0Nag3 nL+I8x0ztc68T7AhePCqkNhKwTe/ajJzsTQsyptLVPevNtG3jclZdAHdvXEHURzDHS mi3zRs0Hta5ya2n7H1lplC54MUMK8DrYiXWBYr34= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190711125759eucas1p1eb80c893d814e311caf62e05af60d236~wW693jgVi2653926539eucas1p1W; Thu, 11 Jul 2019 12:57:59 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 37.05.04298.752372D5; Thu, 11 Jul 2019 13:57:59 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190711125758eucas1p2726d34fa165f6645a51acd9f5b74ee68~wW69CUW4d2688026880eucas1p2j; Thu, 11 Jul 2019 12:57:58 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190711125758eusmtrp11e5293de3383f2e2615ebddb8ffe54ec~wW680Bw2Z2705327053eusmtrp1A; Thu, 11 Jul 2019 12:57:58 +0000 (GMT) X-AuditID: cbfec7f2-f13ff700000010ca-d6-5d2732576105 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6B.04.04140.652372D5; Thu, 11 Jul 2019 13:57:58 +0100 (BST) Received: from [106.120.51.18] (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190711125757eusmtip2f5b45b481281385eea833ffcf9a8fdf9~wW68Aeypy2342723427eusmtip2T; Thu, 11 Jul 2019 12:57:57 +0000 (GMT) Subject: Re: [PATCH 1/3] opp: core: add regulators enable and disable To: Viresh Kumar From: Kamil Konieczny Message-ID: Date: Thu, 11 Jul 2019 14:58:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUzMcRzHfe/3WHP27efUZxjb0YxNYTbfloXNwzF/mM3DWOXST6Gr3K8o bPIYt0rY6E4qG2qhuuvJGsfqdLjU0iPC9WBE56mHFRZ+/Zj+e33fn/d7n/dn+/KU8JaZyu+O TRCNsfoYLetNV9SONMzfsmhO6ILXdf7EmlXMkLaBdwzJddQz5Gz3R4o0NJRw5OmxPo7YulsZ 0lSVzZL+dAciWQ12FbnteMWR622NKvLyaAFL+oafqsjJew6OjLZaaWId1JFSdy27XNDdyrmF dLbCM6yuo/Uuqyu9dkSXUVaIdM72SpWu3zZjA7fNe2mkGLN7v2gMDNnhHf3Aszbe7JPU1OKb gobUJuTFA14MtzvKOBPy5gVcgKDl03VWHgh4AEF282qF+xEcL4J/gRFTClIC+Qgyb9hVysOD wPXwPpJdk/EqaMnNp0yI5zV4HvQ+F2UPhUdoKGmycrKHxUugq7JOJbMar4YvXb1I9tPYH8o8 YbI8BW+FJ44cWrH4wGNzzxh74SCoyCoYi1LYD1705P7lmVDpyabkXYDTeRgaymCV1iuhvNRD KTwZPjjLOIWng+tCGq3wAXh7NYNTwicQuFO//h0EQ42zkZHLUXguFFcFKvIK6D5To5JlwJOg 3eOjdJgE5ysuUYqshtOnBMU9H3J+1TEKTwPTryImE2kt4y6zjLvGMu4ay/+9eYguRH5iomSI EqWFseKBAElvkBJjowJ2xhls6M/nc406v91Bg88iqhHmkXaimvf4hwqMfr+UbKhGwFNajdq+ ZlaooI7UJx8UjXHhxsQYUapG03ha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f6/A9Tc3+NRzufz1KbDk z1D+NU2C/3fygk1F8/JZes3L7m6fwyxtbR6hrnt91We59JfT+hz/ipU/47y7uT42x0vw5fkf l7Me+hyWuKvEUpyRaKjFXFScCADk5HCkDAMAAA== X-CMS-MailID: 20190711125758eucas1p2726d34fa165f6645a51acd9f5b74ee68 X-Msg-Generator: CA X-RootMTR: 20190708141159eucas1p1751506975ff96a436e14940916623722 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190708141159eucas1p1751506975ff96a436e14940916623722 References: <20190708141140.24379-1-k.konieczny@partner.samsung.com> <20190708141140.24379-2-k.konieczny@partner.samsung.com> <20190711062226.4i4bvbsyczshdlyr@vireshk-i7> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190711_055806_073260_D50F097E X-CRM114-Status: GOOD ( 20.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Nishanth Menon , linux-samsung-soc@vger.kernel.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Bartlomiej Zolnierkiewicz , Stephen Boyd , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Chanwoo Choi , Kyungmin Park , Kukjin Kim , MyungJoo Ham , devicetree@vger.kernel.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11.07.2019 08:22, Viresh Kumar wrote: > On 08-07-19, 16:11, k.konieczny@partner.samsung.com wrote: >> From: Kamil Konieczny >> >> Add enable regulators to dev_pm_opp_set_regulators() and disable >> regulators to dev_pm_opp_put_regulators(). This prepares for >> converting exynos-bus devfreq driver to use dev_pm_opp_set_rate(). >> >> Signed-off-by: Kamil Konieczny >> --- >> drivers/opp/core.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 0e7703fe733f..947cac452854 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, >> if (ret) >> goto free_regulators; >> >> + for (i = 0; i < opp_table->regulator_count; i++) { >> + ret = regulator_enable(opp_table->regulators[i]); >> + if (ret < 0) >> + goto disable; >> + } > > What about doing this in the same loop of regulator_get_optional() ? yes, this is good, it will simplify code >> + >> return opp_table; >> >> +disable: >> + while (i != 0) >> + regulator_disable(opp_table->regulators[--i]); >> + >> + i = opp_table->regulator_count; > > You also need to call _free_set_opp_data() here. good catch if I move enable in loop above, then this will not be needed >> free_regulators: >> while (i != 0) >> regulator_put(opp_table->regulators[--i]); >> @@ -1609,6 +1620,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) >> >> /* Make sure there are no concurrent readers while updating opp_table */ >> WARN_ON(!list_empty(&opp_table->opp_list)); > > Preserve the blank line here. > >> + for (i = opp_table->regulator_count - 1; i >= 0; i--) >> + regulator_disable(opp_table->regulators[i]); >> >> for (i = opp_table->regulator_count - 1; i >= 0; i--) >> regulator_put(opp_table->regulators[i]); > > Only single loop should be sufficient for this. you are right, I will do this in single loop I will send v2 -- Best regards, Kamil Konieczny Samsung R&D Institute Poland _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel