Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8826606ybi; Tue, 23 Jul 2019 16:08:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZCAJaWZiKoPdA3+JGz9xZWlN3ApWkgduAA0Rig2G9uuiKlrpziQLqbTPWn0nGwCZPWiLA X-Received: by 2002:a63:1b66:: with SMTP id b38mr78160365pgm.54.1563923312717; Tue, 23 Jul 2019 16:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563923312; cv=none; d=google.com; s=arc-20160816; b=QN+rKk+2I6uXpclaUOfWwIRqrdeXFU2exTxVcFHAUl8wzp+08qATTkLY3vkGnfh9ZW SU78aqYjybFz6lGohZ1nMVoF1sAkyWSFXfh1+O1HjL6HTknJsdpk/KQYggPqvL63z7IF p4UadaLEQeiogwbDF58xmUVbPc4DUHLqHzYWLF+MIl3Y64CF9Oxvo/i887HEve3fMb5/ lMzoV/33y4AjqMZ7IY3Dx5TNQPjA6YSFq9BZrnTE//TWVkxiHobkjf2U5caJ4XWw5Qom JRPrNLV2BMIBZ1X49NhXAZJrDuDGdzK3atRkeYV7mhwkDQWKa8tFu4fkCotnCE7RcPdh 05KA== 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=kmVmqQ7vBBuymdBigbk1kLjY1bQshXiULeywhK0hfzY=; b=pJfofoLvaiD9lqDYO4srw+rrH+bo+VjGDCswSvsmVXsiOSa0TFvRtkWIW6ek+ToKh2 +wbJcm6ZubsoMdRtcJM/qQ9M56qBLns74fJUbt0XbuLLRESR9Zgi/6SE4Tep8Yhs5a/9 2ZbNrwJnSxvwCEBTLlT4NV7JR6X9LgFWwQUD5BRQV9H2HeJUMFwY5Ck0aOTIGhwJQ0U3 U3ry0FK8bcY/Juhjki/i4FIFIawIcK9+iI2zPBPVbMCJ+cjaIw6ZejalcWzU5R8niMSr IKOb3jW8v28ts4+9MGNplGdoFBwHaFLI0HmMbKSd3SW422cKFeQogYkqCzIFBIisxonM gPEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Zi03pn1A; 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 a17si15411718pff.195.2019.07.23.16.08.17; Tue, 23 Jul 2019 16:08:32 -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=Zi03pn1A; 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 S2389843AbfGWMVT (ORCPT + 99 others); Tue, 23 Jul 2019 08:21:19 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38669 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389689AbfGWMU0 (ORCPT ); Tue, 23 Jul 2019 08:20:26 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190723122024euoutp01e3cf6fff8993505c65dccc416d44345d~0CJkg-FUb2865228652euoutp01a for ; Tue, 23 Jul 2019 12:20:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190723122024euoutp01e3cf6fff8993505c65dccc416d44345d~0CJkg-FUb2865228652euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1563884424; bh=kmVmqQ7vBBuymdBigbk1kLjY1bQshXiULeywhK0hfzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zi03pn1AzwwhW4BYdzv1xAgCm7paXtAcqjPRH91bX8pd6NnKUEWY3R6t+LR1nEYun TA+wTw+1Zkfpt9J5zF/1vpGRvZQIKdu7IPJfmZSJVBTauH3KGBMEwjRnD/ujDsiHoB 1eUSsld7JdIWkWc/w/YauvfKVROIkYfRBJ+BWAvg= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190723122023eucas1p17500dad051b1f22442f84c7b36ef48a3~0CJjtjSBw0311003110eucas1p1Q; Tue, 23 Jul 2019 12:20:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F4.75.04325.78BF63D5; Tue, 23 Jul 2019 13:20:23 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190723122022eucas1p1266d90873d564894bd852c20140f8474~0CJjCbjWC3150731507eucas1p1p; Tue, 23 Jul 2019 12:20:22 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190723122022eusmtrp1f00b961ea151a2b89ee920602225ff41~0CJjB1jlQ2487524875eusmtrp1i; Tue, 23 Jul 2019 12:20:22 +0000 (GMT) X-AuditID: cbfec7f5-b75ff700000010e5-9d-5d36fb87d3eb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 38.D8.04140.68BF63D5; Tue, 23 Jul 2019 13:20:22 +0100 (BST) Received: from AMDC3555.DIGITAL.local (unknown [106.120.51.67]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190723122022eusmtip2474dd9922db572afb0b7c0650f28954d~0CJibJLMJ1668716687eusmtip24; Tue, 23 Jul 2019 12:20:22 +0000 (GMT) From: =?UTF-8?q?Artur=20=C5=9Awigo=C5=84?= To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: krzk@kernel.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, inki.dae@samsung.com, sw0312.kim@samsung.com, georgi.djakov@linaro.org, m.szyprowski@samsung.com Subject: [RFC PATCH 01/11] devfreq: exynos-bus: Extract exynos_bus_profile_init() Date: Tue, 23 Jul 2019 14:20:06 +0200 Message-Id: <20190723122016.30279-2-a.swigon@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190723122016.30279-1-a.swigon@partner.samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHKsWRmVeSWpSXmKPExsWy7djP87rtv81iDfb+ErA4dGwru8XGGetZ La5/ec5qMf/IOVaLK1/fs1lM37uJzWLS/QksFufPb2C32PT4GqvF5V1z2Cw+9x5htJhxfh+T xdojd9ktbjeuYLOYMfklmwO/x6ZVnWwed67tYfO4332cyWPzknqPg+/2MHn0bVnF6PF5k1wA exSXTUpqTmZZapG+XQJXxsGDi9gKjilUdK/azdzAuFGqi5GTQ0LARGL73eVsXYxcHEICKxgl juy8xgrhfGGU+Nx/kRWkSkjgM6PEnHuSMB3Xl29hgogvZ5S4c1INruHYh51sIAk2AU+Jnok7 wCaJCBxhlJi84D0LiMMssArI+b6NEaRKWCBYYsmx80A2BweLgKrEmV1iIGFeAUeJeztaWCG2 yUus3nCAGcTmFHCS6DrazgZRIyhxcuYTFhCbGaimeetsZpD5EgIf2SVOvpjFDtHsIrHsVwML hC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qxhFUkuLc9Nzi430ihNzi0vz 0vWS83M3MQKjdNuxn1t2MHa9Cz7EKMDBqMTDu2GPaawQa2JZcWXuIUYJDmYlEd7ABrNYId6U xMqq1KL8+KLSnNTiQ4ymQJ9NZJYSTc4HJpC8knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6Ykl qdmpqQWpRTB9TBycUg2MMz+Xt7Oqlb00ZkyWrZ65dt2ftWKpM5hOfNgdt2nh87xEDuZpbIwh 0tPlglfFLvn9skuyzE+h/dbs2DVSnZ0eVdF8O0ykP4v/YPzXdPevbMkjcaknTGXB+hVCD+o8 FKPunmWwNZ+VVeS45fXRtaFMP7uCvYVZfZyev2fl/zWtW0rvfZu60EQlluKMREMt5qLiRACS 1DSG6AIAAA== X-CMS-MailID: 20190723122022eucas1p1266d90873d564894bd852c20140f8474 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190723122022eucas1p1266d90873d564894bd852c20140f8474 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190723122022eucas1p1266d90873d564894bd852c20140f8474 References: <20190723122016.30279-1-a.swigon@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds a new static function, exynos_bus_profile_init(), extracted from exynos_bus_probe(). Signed-off-by: Artur Świgoń --- drivers/devfreq/exynos-bus.c | 106 ++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index d9f377912c10..d8f1efaf2d49 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -372,12 +372,69 @@ static int exynos_bus_parse_of(struct device_node *np, return ret; } +static int exynos_bus_profile_init(struct exynos_bus *bus, + struct devfreq_dev_profile *profile) +{ + struct device *dev = bus->dev; + struct devfreq_simple_ondemand_data *ondemand_data; + int ret; + + /* Initialize the struct profile and governor data for parent device */ + profile->polling_ms = 50; + profile->target = exynos_bus_target; + profile->get_dev_status = exynos_bus_get_dev_status; + profile->exit = exynos_bus_exit; + + ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL); + if (!ondemand_data) { + ret = -ENOMEM; + goto err; + } + ondemand_data->upthreshold = 40; + ondemand_data->downdifferential = 5; + + /* Add devfreq device to monitor and handle the exynos bus */ + bus->devfreq = devm_devfreq_add_device(dev, profile, + DEVFREQ_GOV_SIMPLE_ONDEMAND, + ondemand_data); + if (IS_ERR(bus->devfreq)) { + dev_err(dev, "failed to add devfreq device\n"); + ret = PTR_ERR(bus->devfreq); + goto err; + } + + /* Register opp_notifier to catch the change of OPP */ + ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); + if (ret < 0) { + dev_err(dev, "failed to register opp notifier\n"); + goto err; + } + + /* + * Enable devfreq-event to get raw data which is used to determine + * current bus load. + */ + ret = exynos_bus_enable_edev(bus); + if (ret < 0) { + dev_err(dev, "failed to enable devfreq-event devices\n"); + goto err; + } + + ret = exynos_bus_set_event(bus); + if (ret < 0) { + dev_err(dev, "failed to set event to devfreq-event devices\n"); + 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_simple_ondemand_data *ondemand_data; struct devfreq_passive_data *passive_data; struct devfreq *parent_devfreq; struct exynos_bus *bus; @@ -418,52 +475,9 @@ static int exynos_bus_probe(struct platform_device *pdev) if (ret < 0) goto err; - /* Initialize the struct profile and governor data for parent device */ - profile->polling_ms = 50; - profile->target = exynos_bus_target; - profile->get_dev_status = exynos_bus_get_dev_status; - profile->exit = exynos_bus_exit; - - ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL); - if (!ondemand_data) { - ret = -ENOMEM; + ret = exynos_bus_profile_init(bus, profile); + if (ret < 0) goto err; - } - ondemand_data->upthreshold = 40; - ondemand_data->downdifferential = 5; - - /* Add devfreq device to monitor and handle the exynos bus */ - bus->devfreq = devm_devfreq_add_device(dev, profile, - DEVFREQ_GOV_SIMPLE_ONDEMAND, - ondemand_data); - if (IS_ERR(bus->devfreq)) { - dev_err(dev, "failed to add devfreq device\n"); - ret = PTR_ERR(bus->devfreq); - goto err; - } - - /* Register opp_notifier to catch the change of OPP */ - ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); - if (ret < 0) { - dev_err(dev, "failed to register opp notifier\n"); - goto err; - } - - /* - * Enable devfreq-event to get raw data which is used to determine - * current bus load. - */ - ret = exynos_bus_enable_edev(bus); - if (ret < 0) { - dev_err(dev, "failed to enable devfreq-event devices\n"); - goto err; - } - - ret = exynos_bus_set_event(bus); - if (ret < 0) { - dev_err(dev, "failed to set event to devfreq-event devices\n"); - goto err; - } goto out; passive: -- 2.17.1