Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4174864ybi; Mon, 15 Jul 2019 05:05:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqynJgkyGAYxxHpvqkRMaEhrjrn7QXjHpQ8BfUmOk2xZ0rKF5xjYIIkdWs56mBbseyx5NMLu X-Received: by 2002:a63:c302:: with SMTP id c2mr25043708pgd.300.1563192321163; Mon, 15 Jul 2019 05:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563192321; cv=none; d=google.com; s=arc-20160816; b=evEqqhfdtLbpKgGyI3PWPr4QeHS+odp2oWcktZGA4IDygWn9UKfrmMIeW8MxJYYAs2 nwz6DcUSJyjv9f9OPaAv5jACarBaKhNcMagddEsYAZLadqXpXtSZZaCDdIT2cZaAxtCH npbOGaT7dWmijCRQEUO5lSR1IiU1DwH/U6p29Bgy1Jhm+b6iW0EB5ZSTXv/a8yhsadVy duxtm+zn4qS9utrqi9Dq6yf/aT05nnSD+NW0RPToDwu9AOppOkoSLOJGlsUk4s+y7SdS +B4/HqZo0IdUYZH4qj4lxJCSXOdvodo+stnMve5Qa62zbCrLZI5EO3HihFzwrgiaGDvN xwag== 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:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=slNR/BE5Z02LanzgRyRt+VQF3nSEOhb3VQJmenTTtaY=; b=hjMPNRFeZgdLu6OwdmV9js00abxHC1PQ6viRH43YlwspGnvKP7kN6bso1SclsKySRs pGCNu4eTUCDGj0eNClYQcQ5I45dlw5zaCyC0Vm+PvaT8u7KW7G5NopvK3K6iwLILiYUF 6G7sIGfQuuR3w+CrxHGVvWn4XbNNtDYXG1G8MwiXwmxHRbIrIH3KgHC6PR9+G0WY67OU YFMa0j0JzyCLzRcanvgTReNXBbN+bTX/gYKy/Ws0m5wxXX2f8aJ+qBYcriekK0C8fxaJ 8GPJUVkXC9IXRVXKky6fZTXNFm30joiJ8UFnKNz8WSCVAsS9vW++qontLDYVaDzI7P7J GmFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ttYj8HvI; 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 u3si16590970pgm.122.2019.07.15.05.05.01; Mon, 15 Jul 2019 05:05:21 -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=ttYj8HvI; 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 S1729946AbfGOMEg (ORCPT + 99 others); Mon, 15 Jul 2019 08:04:36 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46088 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729945AbfGOMEe (ORCPT ); Mon, 15 Jul 2019 08:04:34 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190715120432euoutp017868cc05e04c590d1ca75a1c8c71f6a2~xkxbovIMA2169221692euoutp012 for ; Mon, 15 Jul 2019 12:04:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190715120432euoutp017868cc05e04c590d1ca75a1c8c71f6a2~xkxbovIMA2169221692euoutp012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1563192272; bh=slNR/BE5Z02LanzgRyRt+VQF3nSEOhb3VQJmenTTtaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttYj8HvI2e/1c/1PxHy4J3YWxy+ZxJtzwC/Dr9AZ35LvLk+B+V2zg2dgg6cCfEFlx db8sOUBqrEuclE2kX/9+1R04J9QeFTm+lafT9iFR1b3xV3aBvlf9uIiJ43NKuVxAbO MRH86NFHv9IbP+IAFnYxvqtwVT4wgG6m8iaECzu4= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190715120431eucas1p214ba80053c1337718831edf3e1075e27~xkxa-E6mD0932509325eucas1p2I; Mon, 15 Jul 2019 12:04:31 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 9A.FF.04298.FCB6C2D5; Mon, 15 Jul 2019 13:04:31 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3~xkxaPhxYD3262432624eucas1p1N; Mon, 15 Jul 2019 12:04:30 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190715120430eusmtrp13259615bc9da1a3f1a30ea6ffe1b0b1f~xkxaOlzLs1141311413eusmtrp1V; Mon, 15 Jul 2019 12:04:30 +0000 (GMT) X-AuditID: cbfec7f2-f2dff700000010ca-cd-5d2c6bcf7dd5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 82.5B.04146.ECB6C2D5; Mon, 15 Jul 2019 13:04:30 +0100 (BST) Received: from AMDC3218.DIGITAL.local (unknown [106.120.51.18]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190715120429eusmtip105ecc88f117c85cd52ccd596843a4ac3~xkxZa1v1B2021620216eusmtip1m; Mon, 15 Jul 2019 12:04:29 +0000 (GMT) From: Kamil Konieczny To: k.konieczny@partner.samsung.com 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 Subject: [PATCH v2 1/4] opp: core: add regulators enable and disable Date: Mon, 15 Jul 2019 14:04:13 +0200 Message-Id: <20190715120416.3561-2-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190715120416.3561-1-k.konieczny@partner.samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01SWUwTQRh29ugu1epSSBir8agxinJINHESxaASs4+EBzUaLFU2QKBVuxyi D4IH0kYR0CgUPIgXIShQrlKKB1bWxkoDJHgQFAQ1QSDYqmkjiLSLx9s33zH/90+GxuUDpIJO 1WZwOq06XSmREs2dXme4My0sYcOUNxDVl9aS6NW3zyS6YesiUeHDGYAuDn/BkdNZR6GXp8Yo ZBruI1GvpUKC3BdsAJU6H2Lovm2AQndedWOoP69KgsY8LzF0tt1GoV999QRqGOyUxMjZmus1 gDVV6yVsw+2T7JMJK8YWNlYDVnjdgrFu07I4ap90axKXnprF6SK3JUpT+vuLqSNdsmP2x7ty wbX5BkDTkNkE77yJMgApLWeqABwyfgTi4RuAtqk8Ujy4ASxwNeAGEOBP1LeX4qJwD8CiyXzi b0T/c9LvkjCb4YcWB+bDwcwqeOndVX8CZ7wErOutp3xCEBML+ybfUr4iBLMaGup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Wwio puVVPwtEvaDEyZlPwGxmoPrmrbOZJzAKzEKSmoUktYCRaRWjSGppcW56brGhXnFibnFpXrpe cn7uJkZgTG479nPzDsZLG4MPMQpwMCrx8DqkaMcKsSaWFVfmHmKU4GBWEuG1/QoU4k1JrKxK LcqPLyrNSS0+xGgK9MNEZinR5HxgusgriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2a WpBaBNPHxMEp1QB03zLVSWWLLLzuy0zx/N6+5XrU7/iZdwRW737eFsroNkFwa+1lE7b1zW5X TrakzZ67aPr8qq2S516n25sHtuw9G/m3WiNg546AsysPvju9c9aLIMWz1RtlJDqvnVkYedJk nsbj1fPYTC5fjehr2qKW+GH7Eeerp7nOzxMznR6y/eU7/bbcqO8CSizFGYmGWsxFxYkAHY07 CN8CAAA= X-CMS-MailID: 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3 References: <20190715120416.3561-1-k.konieczny@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Changes in v2: - move regulator enable and disable into loop --- drivers/opp/core.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 0e7703fe733f..069c5cf8827e 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1570,6 +1570,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, goto free_regulators; } + ret = regulator_enable(reg); + if (ret < 0) + goto disable; + opp_table->regulators[i] = reg; } @@ -1582,9 +1586,15 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, return opp_table; +disable: + regulator_put(reg); + --i; + free_regulators: - while (i != 0) - regulator_put(opp_table->regulators[--i]); + for (; i >= 0; --i) { + regulator_disable(opp_table->regulators[i]); + regulator_put(opp_table->regulators[i]); + } kfree(opp_table->regulators); opp_table->regulators = NULL; @@ -1610,8 +1620,10 @@ 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)); - for (i = opp_table->regulator_count - 1; i >= 0; i--) + for (i = opp_table->regulator_count - 1; i >= 0; i--) { + regulator_disable(opp_table->regulators[i]); regulator_put(opp_table->regulators[i]); + } _free_set_opp_data(opp_table); -- 2.22.0