Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10534625ybi; Thu, 11 Jul 2019 06:53:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0X5eYBnZXvxPrAMRaqABxjrRBtrFJX3yqv1iM+iNFfTEwF78FYXi1mLAE7UwSz1PZCMFP X-Received: by 2002:a17:902:24b:: with SMTP id 69mr4662782plc.250.1562853215789; Thu, 11 Jul 2019 06:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562853215; cv=none; d=google.com; s=arc-20160816; b=K2jIZ820V6k4vlfu8YNqYLrsO6299KYaLVFnfkbM7bPbSY4OIx3TK5CUyUsrg6pA6I Px8v9a/3Jk9wGPAb5WIWas6MbE8gQ8UjE7na7LY7ocg2qqhhmCOQrtrDKLicWIdjBH9Q k1QE9bSYuUIZFa36T4qiLi97BKHWkhkxLbJhtgQCFSsXJ5xo4eg+EVtvviNpJ6uVUIlL NqpnuLA+TGQYz20t4BJzY2lN6WdHLmtPpLV+ry21zjDXR4MH8MA+WzSRtLFHtL2KASBy wmSCgVKJ3LOD3kxKWlfTqhAO+AUQ38wipo0WSaB8IeY87wT5xoIF8mq6ybH8V3D+qfjQ 22OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=vU9qDdY1dDbJlzQ9n1GbwihwW2hQxnIb8uEXqej1M0w=; b=Qa6ocp0RZLBXzhd29lQtfRCjA6KutdF5RaM0wRta21wguy4DhoMFu1gGrrTvkv8lpy 4LVsYgOtyQgd5QD0eQon9w3QhLog1frHXrSOq8UsEUozPZUEwvM83vmEZrYwWznWKTu5 zK6VkTjwM2KU+lX8ActTGWqrBmqHQypbyozZbT5XthzBlmj7umX/4vM7/8dQn3VpV/cZ he2ob3FMduc+hj11jP7eqH7hUYqeeQoLE5+e4w6SzTjfMkOQyfv9M5tif6kiYTZVa8wZ IuMNMrWwemztaJBTruGo2DYY2VoNGM5jjAXumHCP3C9qUqYZawlyTVuNzjcMRmIuv2c3 we/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=OgaSn6Mc; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si5305585pfm.236.2019.07.11.06.53.20; Thu, 11 Jul 2019 06:53:35 -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=@samsung.com header.s=mail20170921 header.b=OgaSn6Mc; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728458AbfGKM6D (ORCPT + 99 others); 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+F2UPhUdoKGmycrKHxUugq7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+A2ZwClhLbZqwAa2UWUJf4M+8SM4QtLnHryXyouLzE9rdzmCcwCs1C0j4LScssJC2zkLQs YGRZxSiSWlqcm55bbKRXnJhbXJqXrpecn7uJERjt24793LKDsetd8CFGAQ5GJR7egIeqsUKs 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