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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 7BF9FC43603 for ; Tue, 10 Dec 2019 04:14:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47C9C2071E for ; Tue, 10 Dec 2019 04:14:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="nGNFzrq0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726835AbfLJEO0 (ORCPT ); Mon, 9 Dec 2019 23:14:26 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:51558 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfLJEOZ (ORCPT ); Mon, 9 Dec 2019 23:14:25 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20191210041421epoutp04ef4d9dccf33614ca8eb502c514f5a931~e51KCHibW2452024520epoutp046 for ; Tue, 10 Dec 2019 04:14:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20191210041421epoutp04ef4d9dccf33614ca8eb502c514f5a931~e51KCHibW2452024520epoutp046 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1575951261; bh=OdhN49WK8rm0oTDRkqLL4LWFQFuzsTtK9rjB+lhhG9g=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=nGNFzrq01n5uE3LQRuaCzFcHWv3ueuxqhckoU6lC5plxBmrcfAvH8+Lb/x3iLTVwk u6dQPcAlHJIoleOnGiqcnhHh+rsYRcLPStAI7cUans0tUOlqnPNZx84WkdAXc3618h q3DUPh/5BvTTJIRmIrBXujI/G+VyOe5haUNmepwg= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20191210041420epcas1p40574525a696a3270c0f5e7858d6d1154~e51Jf2_NO2926329263epcas1p4D; Tue, 10 Dec 2019 04:14:20 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.40.154]) by epsnrtp3.localdomain (Postfix) with ESMTP id 47X6By1kJLzMqYkn; Tue, 10 Dec 2019 04:14:18 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 77.C9.48019.A9B1FED5; Tue, 10 Dec 2019 13:14:18 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20191210041417epcas1p42c8da7d1c32b317fd9badf04d14daeda~e51G_u5y_2924429244epcas1p4Q; Tue, 10 Dec 2019 04:14:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191210041417epsmtrp1638f85d4efde68a658466942d237522c~e51G93BVD2236922369epsmtrp1r; Tue, 10 Dec 2019 04:14:17 +0000 (GMT) X-AuditID: b6c32a38-257ff7000001bb93-3a-5def1b9ae913 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6B.36.10238.99B1FED5; Tue, 10 Dec 2019 13:14:17 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191210041417epsmtip23108a8a854cc8441aa421f3417ff3619~e51Grqjp_2166321663epsmtip23; Tue, 10 Dec 2019 04:14:17 +0000 (GMT) Subject: Re: [PATCH v3 1/4] devfreq: exynos-bus: Extract exynos_bus_profile_init() To: =?UTF-8?B?QXJ0dXIgxZp3aWdvxYQ=?= , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Cc: 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 From: Chanwoo Choi Organization: Samsung Electronics Message-ID: <3d2c8269-cefe-0736-4fb9-729cc337db43@samsung.com> Date: Tue, 10 Dec 2019 13:20:43 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: <20191209104902.11904-2-a.swigon@samsung.com> Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHJsWRmVeSWpSXmKPExsWy7bCmru4s6fexBo8f81jcn9fKaLFxxnpW i0n3J7BYLPg0g9Wi//FrZovz5zewW5xtesNuseLuR1aLTY+vsVpc3jWHzeJz7xFGixnn9zFZ rD1yl93iduMKNosZk1+yOfB7bFrVyeaxeUm9x8Z3O5g8+rasYvT4vEkugDUq2yYjNTEltUgh NS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6FolhbLEnFKgUEBicbGS vp1NUX5pSapCRn5xia1SakFKToFlgV5xYm5xaV66XnJ+rpWhgYGRKVBhQnbG056rbAXHlCv6 zy9gbWCcKNPFyMEhIWAiMeETW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HZ7FCJCQlpl08 ytzFyAFkC0scPlwMUfOWUaLt4y4WkBphgRCJpkmX2EESIgIHGCU275zNBJJgFvjCKHH0SThE x15Giaa/19hBEmwCWhL7X9xgA7H5BRQlrv54zAhi8wrYSTR1tIM1swioSvxYsRfMFhUIk9i5 5DETRI2gxMmZT8A2cwpYSex+9J0VYpm6xJ95l5ghbHGJW0/mQx0hL9G8dTbzBEbhWUjaZyFp mYWkZRaSlgWMLKsYJVMLinPTc4sNCwzzUsv1ihNzi0vz0vWS83M3MYLjU0tzB+PlJfGHGAU4 GJV4eBc4vIsVYk0sK67MPcQowcGsJMJ7vA0oxJuSWFmVWpQfX1Sak1p8iFGag0VJnPdp3rFI IYH0xJLU7NTUgtQimCwTB6dUA6Pm0gZ5u6XHdPbxP9I5yDT5uAPPs7MTH5kdsBEVai+x9zfI CE3ilwsxTsnel3RwJf8Ur7WuStwc/wtFqk65HqtMF/t+RdTZZEPkQ/U/sndMt/sUch6bHpOT XpFjfc7n7eIv4pW+WWXHM3c4akgpfP2+4cv+6cfrKnesydilXHrR2s7i5L33+UosxRmJhlrM RcWJAP4D/xTLAgAA X-CMS-MailID: 20191210041417epcas1p42c8da7d1c32b317fd9badf04d14daeda X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20191209105031eucas1p137c3c5b0046570453e1ebed2dcd88277 References: <20191209104902.11904-1-a.swigon@samsung.com> <20191209104902.11904-2-a.swigon@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/9/19 7:48 PM, Artur Świgoń wrote: > 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 c832673273a2..b8ca6b9f4b82 100644 > --- a/drivers/devfreq/exynos-bus.c > +++ b/drivers/devfreq/exynos-bus.c > @@ -287,12 +287,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; > @@ -334,52 +391,9 @@ static int exynos_bus_probe(struct platform_device *pdev) > if (passive) > goto passive; > > - /* 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: > Applied it. Thanks. -- Best Regards, Chanwoo Choi Samsung Electronics