From patchwork Mon Dec 9 10:49:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= X-Patchwork-Id: 11279079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2D75138D for ; Mon, 9 Dec 2019 10:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7544E20828 for ; Mon, 9 Dec 2019 10:50:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="RYLJ8a3h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbfLIKue (ORCPT ); Mon, 9 Dec 2019 05:50:34 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52506 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbfLIKue (ORCPT ); Mon, 9 Dec 2019 05:50:34 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191209105033euoutp0115e19e9b1ca3521a42e2ab1443c8c8a7~erlzV-pQR0195201952euoutp01X for ; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191209105033euoutp0115e19e9b1ca3521a42e2ab1443c8c8a7~erlzV-pQR0195201952euoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1575888633; bh=bQfaK3H9O2avQYC2R28z2VtVDLkeXfgJH5IcB1mxqe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYLJ8a3hTe/OOoTe9JbniNjFuPGeqCDInx4ulNCXQskG8JPUZhidChrlGvVvHItRH X6y/jgZe/IbCvZa7Buog2RzLUnI0hVijeDUBrTEcUojHmcp5s1IuT4Gz/JOeQHtshx VRu1DwU93/nf9Q+x5kv1Dmci3vWwV6EgGDsI9low= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191209105033eucas1p1dfa9ba65a240fe8b871e8e8727ddba22~erlzCvAJH0954309543eucas1p1k; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 2B.34.60698.8F62EED5; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191209105032eucas1p13fa6c46a1e80cdda68ab4bac3e008b8f~erlypQkhy0955109551eucas1p1f; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191209105032eusmtrp16fb547a39e6f6d1b5dd5f8f55890489b~erlyokVPQ2125621256eusmtrp1X; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-87-5dee26f8fddd Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A1.D7.07950.8F62EED5; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) Received: from AMDC3555.digital.local (unknown [106.120.51.67]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191209105031eusmtip185d18721653d060ac1dedd6a86189480~erlx1udGa2957929579eusmtip1n; Mon, 9 Dec 2019 10:50:31 +0000 (GMT) From: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Cc: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , cw00.choi@samsung.com, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, inki.dae@samsung.com, sw0312.kim@samsung.com, k.konieczny@samsung.com, leonard.crestez@nxp.com Subject: [PATCH v3 2/4] devfreq: exynos-bus: Extract exynos_bus_profile_init_passive() Date: Mon, 9 Dec 2019 11:49:00 +0100 Message-Id: <20191209104902.11904-3-a.swigon@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209104902.11904-1-a.swigon@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRj229nZjquN41R8s1AbZCWklUVfGpERtiJIoigsqZkHFa/tqGV/ Mk0xb3nB3CxNTJdpeZkXVEhjWt6SYYYZpossvOXEdJUSlvNo+e95n8v7fC98FCHtIe2p4PAo RhmuCJUJRPyG1wv6XQvORr/dxZ7YUJiIcI2qisTv58dInG3I5OOi7yoS3xudIrBeXy3EvfHf hLhseJbE2tEBEvc3PxTgufR2hFX6Fh5+3j4sxEO3ywRYlTMhOELLteV3BfLaklvyGmMjT55R V47kc1oHH9JXdCiACQ2OYZRuh6+IgipHpgWRcZtuLKVX8+NQl00KsqSA3gemcQ1KQSJKSpch yNclkNwwj2BCl8vjhjkEyWU6Yi2S+uLdauQJgvqcFt6/yLNFAzK7BLQXZOd+EpoFGzoRQZ/+ A2EeCLqbB+NJ8aTZZU1fgM7WSZ4Z8+ltYDLOrXSI6YNQOvRWyPU5QkX1yxXekvaAWU2vkPNY QZf6C9+MiWVPQv2DlQKgJ4Qw83gYceFjUFs4RnLYGiY76laXboGenDQ+h1n42mQguXAcAq2m ffVST2jr6FsWqOWGnVDV7MbRXjDYkYXMNNASGJy24t4ggeyGPIKjxZCcJOWgDJrVEi4IEF8x sLpbDsaCAiITbc1fd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NbUg tQimj4mDU6qB8eCxv2fCVuqu5T5WK6gglbzh5NHihW5l/8w5jn1cYhs88+r2DJmSC9q/Pnpm nT+Yeni1Y7XoDkOZliSBEJnGs6f3zY64nVDr9FK6oXmdhEpt4XTbF0xP67affxY1+5gI19Yj PeoqnT+bPuhpzd22NLIyqCR8uUigyUZl9T6+qV7iR2YK2zy+p8RSnJFoqMVcVJwIADIpCafi AgAA X-CMS-MailID: 20191209105032eucas1p13fa6c46a1e80cdda68ab4bac3e008b8f X-Msg-Generator: CA X-RootMTR: 20191209105032eucas1p13fa6c46a1e80cdda68ab4bac3e008b8f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191209105032eucas1p13fa6c46a1e80cdda68ab4bac3e008b8f References: <20191209104902.11904-1-a.swigon@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch adds a new static function, exynos_bus_profile_init_passive(), extracted from exynos_bus_probe(). Signed-off-by: Artur Świgoń --- drivers/devfreq/exynos-bus.c | 70 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index b8ca6b9f4b82..19d9f9f8ced2 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -345,13 +345,51 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, return ret; } +static int exynos_bus_profile_init_passive(struct exynos_bus *bus, + struct devfreq_dev_profile *profile) +{ + struct device *dev = bus->dev; + struct devfreq_passive_data *passive_data; + struct devfreq *parent_devfreq; + int ret = 0; + + /* Initialize the struct profile and governor data for passive device */ + profile->target = exynos_bus_target; + profile->exit = exynos_bus_passive_exit; + + /* Get the instance of parent devfreq device */ + parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0); + if (IS_ERR(parent_devfreq)) { + ret = -EPROBE_DEFER; + goto err; + } + + passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); + if (!passive_data) { + ret = -ENOMEM; + goto err; + } + passive_data->parent = parent_devfreq; + + /* Add devfreq device for exynos bus with passive governor */ + bus->devfreq = devm_devfreq_add_device(dev, profile, DEVFREQ_GOV_PASSIVE, + passive_data); + if (IS_ERR(bus->devfreq)) { + dev_err(dev, + "failed to add devfreq dev with passive governor\n"); + ret = PTR_ERR(bus->devfreq); + goto err; + } + +err: + return ret; +} + static int exynos_bus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node, *node; struct devfreq_dev_profile *profile; - struct devfreq_passive_data *passive_data; - struct devfreq *parent_devfreq; struct exynos_bus *bus; int ret, max_state; unsigned long min_freq, max_freq; @@ -397,33 +435,9 @@ static int exynos_bus_probe(struct platform_device *pdev) goto out; passive: - /* Initialize the struct profile and governor data for passive device */ - profile->target = exynos_bus_target; - profile->exit = exynos_bus_passive_exit; - - /* Get the instance of parent devfreq device */ - parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0); - if (IS_ERR(parent_devfreq)) { - ret = -EPROBE_DEFER; + ret = exynos_bus_profile_init_passive(bus, profile); + if (ret < 0) goto err; - } - - passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); - if (!passive_data) { - ret = -ENOMEM; - goto err; - } - passive_data->parent = parent_devfreq; - - /* Add devfreq device for exynos bus with passive governor */ - bus->devfreq = devm_devfreq_add_device(dev, profile, DEVFREQ_GOV_PASSIVE, - passive_data); - if (IS_ERR(bus->devfreq)) { - dev_err(dev, - "failed to add devfreq dev with passive governor\n"); - ret = PTR_ERR(bus->devfreq); - goto err; - } out: max_state = bus->devfreq->profile->max_state;