From patchwork Mon Dec 9 10:48:59 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: 11279087 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 F1DB415AB for ; Mon, 9 Dec 2019 10:50:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA18A207FF for ; Mon, 9 Dec 2019 10:50:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LjE7c7LL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OIrzvWlm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA18A207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lclUusKPh0nJa3ylrCMcw5Y7+OHxoXNgmAw4ZDV7Eyg=; b=LjE7c7LLO8IqwC OiwR8EP7a0shwOsfmZBogK9xmccDu5jYo+B8TNziqjW7k1gePMVO5DWB6f9d9Ngo4VD11xqtSPyrk g9QVbraTOjCH89a9B64kMfRyMUz0zrRDZSoO8cqvaUMEsSKPBePRp5rOysjxrIp+HP/U4qSIb7dPd C9HjciZAfA1mUhF/qhFpOouRZHJUgwl+w3sLSIqEFIF4NuPs3SWEFXtuPePrsnLye1z2YXuYgFQ5x 6+qiEeW3CphHg5P4pnj36BHatihzjnbZ/jMB1YpfK5YoZ67WsHHBz6ThWoH70s3ytptWcaVkDLohd tqpyxaMV08CTEZJ3x7Og==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGct-0003TH-Qu; Mon, 09 Dec 2019 10:50:51 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGcd-0003FT-Dz for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 10:50:37 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191209105032euoutp0158f4d2d399472ac742d02cc2eb95e93f~erlym-Yom0195201952euoutp01V for ; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191209105032euoutp0158f4d2d399472ac742d02cc2eb95e93f~erlym-Yom0195201952euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1575888632; bh=bcPn7XbAqvxY5Dgi7VEkZejGI3WMO327V8bJhV6vE2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIrzvWlmMEJHO/0zVf8sxhCEvmA30igvL9d+QRtkKQeJL1JupwFWW0nZ+xoUwvxKe 5Tj8bLwKnOW+4a3dlmEwNqvL+BkZZML+6cA3wPEDBPGcLlSzgAUhtyuHop73SG0vIh qj6Ra132Fr3cTmuqfBSNnJkw5vnU9j2+9+qV0qmQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191209105032eucas1p26a6cdbbd340fbd5ac30c54cd23687ff6~erlyYZSUi1375713757eucas1p2G; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id B1.2E.60679.8F62EED5; Mon, 9 Dec 2019 10:50:32 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191209105031eucas1p137c3c5b0046570453e1ebed2dcd88277~erlx53plj0955109551eucas1p1d; Mon, 9 Dec 2019 10:50:31 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191209105031eusmtrp134181cb24b58068e24635b8cb9bf67af~erlx5E9aV2135321353eusmtrp1Y; Mon, 9 Dec 2019 10:50:31 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-4d-5dee26f8058a Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 00.D6.08375.7F62EED5; Mon, 9 Dec 2019 10:50:31 +0000 (GMT) Received: from AMDC3555.digital.local (unknown [106.120.51.67]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191209105030eusmtip1acf41eadd0fd3b90e317d87f9f1abd40~erlxDdNg43004330043eusmtip1e; Mon, 9 Dec 2019 10:50:30 +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 Subject: [PATCH v3 1/4] devfreq: exynos-bus: Extract exynos_bus_profile_init() Date: Mon, 9 Dec 2019 11:48:59 +0100 Message-Id: <20191209104902.11904-2-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: H4sIAAAAAAAAA01SbUhTYRjl3d29u2qz27XoaYXZIikjrezH60f2QdGIIn8EgTBq5kUzXbWb pv3IqWyVldYqmhY2w+bYKG2WqT/KzJxltlTQldhiFc2PJL8gM6Jt16h/53nOOc95D7w0wb4i ZfQR9UlOo1ZlyalgcUP7jHPdj8gx5frrhSx2V+oQfmCsJXH/1FcSG9yXxdg0YSRx2acRAjud dRLcVTQqwZbBcRLbP/WRuLf5FoUnL7UhbHQ+EeF7bYMSPFBoobDx6hC1lVHYrecpRX11geLB WKNIUfrQihST9vBkMiU4MY3LOpLLaWKSDgVneL33xcdbI/I+VHVItKhWVoKCaGA2wXTlGFmC gmmWsSBw1HWL/ATLTCF4/D1OICYReEu7xX8dDWV3KYGoQVBvLhcJg8/x8aItYKeYbWC4/lHi JxYyOgTdzneEfyCYVyLw6otIvyqMSYaRIhPlx2JmFTQ5bIEMKRMHT723RULecrDVtRB+HMTE w7i5SyJoFsDL8s8BPeHTFD+6GQgAxiMBy0CPRDDvgDbjNUrAYTDseDi3XwadVy/OFeLhS5Ob FMxaBHZzGyEQCfDc0e0jaF/CGqhtjvFD8FVzV64UYCi4vi0QnhAKhoYbhLCWwjk9K0A5NJeH CucAimx9c6cV4Hk2QV5GKyr+61LxX5eKf6kmRFjRYi6Hz07n+I1q7lQ0r8rmc9Tp0YePZduR 74d1/nZMNaLmX6mtiKGRfJ40Iv6bkiVVuXx+disCmpAvlFZfGVay0jRV/mlOc+ygJieL41vR UlosXyyNvTOkZJl01UnuKMcd5zR/WREdJNOiA9BrujCzMbKpSxbr6o86M3HJpd+83nOWnp1e s9N1gu8cah/PKwgZC1sie62XRWxRZO4eDU/Da+ePVL3eNZzQ07jvTHLxBsIc5VoUPZva4dmf +ihxdM/2+rcvdFPaNHuMIeXnaqtpd2bIOevgXkdGTQn9faDlTWmN7nCLLem9tl0u5jNUG6II Da/6A/X3Yk5dAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsVy+t/xu7rf1d7FGkzbqG1xf14ro8XGGetZ La5/ec5qMen+BBaLBZ9msFr0P37NbHH+/AZ2i7NNb9gtVtz9yGqx6fE1VovLu+awWXzuPcJo MeP8PiaLtUfuslvcblzBZjFj8ks2BwGPTas62Tw2L6n32PhuB5NH35ZVjB6fN8kFsEbp2RTl l5akKmTkF5fYKkUbWhjpGVpa6BmZWOoZGpvHWhmZKunb2aSk5mSWpRbp2yXoZbx4sY6l4JBC xb2FJ9gbGNdLdTFyckgImEhs61/KBmILCSxllGhYwwwRl5D4uP4GK4QtLPHnWhdQDRdQzSdG iZe979hBEmwCjhKTpj5gB0mICHQySqxfNp0JxGEWuMEk0bTlHQtIlbCAn8TJB+1go1gEVCV2 Hl8NFucVsJTY/2I+E8QKeYnVGw6AreYUsJL4uOwsO8RJlhJzF8LUC0qcnPkEyOYAWqAusX6e EEiYGai1eets5gmMgrOQVM1CqJqFpGoBI/MqRpHU0uLc9NxiQ73ixNzi0rx0veT83E2MwNjc duzn5h2MlzYGH2IU4GBU4uGtsHkbK8SaWFZcmXuIUYKDWUmEd8nEV7FCvCmJlVWpRfnxRaU5 qcWHGE2BXpvILCWanA9MG3kl8YamhuYWlobmxubGZhZK4rwdAgdjhATSE0tSs1NTC1KLYPqY ODilGhiz2ua9v7u2yeOkREH1yfJNz9b/mP46K7PoYfnpFQn/A//Jv5R6fpCb3fFwsLFu0M9S zhgRTe6iPy2xRcq6lm4Plni8V1qvs1/sZVbbxUplxZjZJ7cfOP9nWc56k+qXTMon+7PtPtzI 8L+/puOdxF39F9YHD6SWt7zwuvzh5fXnzCxz7Y9PE7ymxFKckWioxVxUnAgArShV2uMCAAA= X-CMS-MailID: 20191209105031eucas1p137c3c5b0046570453e1ebed2dcd88277 X-Msg-Generator: CA X-RootMTR: 20191209105031eucas1p137c3c5b0046570453e1ebed2dcd88277 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191209105031eucas1p137c3c5b0046570453e1ebed2dcd88277 References: <20191209104902.11904-1-a.swigon@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191209_025035_681587_EE40A760 X-CRM114-Status: GOOD ( 15.42 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.11 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: b.zolnierkie@samsung.com, k.konieczny@samsung.com, sw0312.kim@samsung.com, =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , krzk@kernel.org, inki.dae@samsung.com, cw00.choi@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, myungjoo.ham@samsung.com, leonard.crestez@nxp.com, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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: 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: 11279093 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 02381138D for ; Mon, 9 Dec 2019 10:51:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1EA8207FD for ; Mon, 9 Dec 2019 10:51:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iQCrDv+W"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="RYLJ8a3h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1EA8207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LdUK2vJVDMxfeO/0eO9ukh3GsBMOGkR6++M4a5pXtgA=; b=iQCrDv+WKeFu3s vBi57AyEfFLDvmj1quUtUoZtYlqB8uILm+NyWoHY55w1kzT/TYwCQiRH5LsePTaVElGz1w4xeCQiY sdEoqzsRhKm2VGdvfj6kaV9CWXU/NaArSOSp5QGVoCPVJ4kchZJVz39PMFcGAdaTZgeajpbXDjJ3N ezNvXdOr+m/jCFcjbkUpQ7fFscyeT6jA7nQGiFgdOawWnFl6dFPOTSYFV/YL8lQ5iS0e1bF801/bE P3zOupQaCP8jflFMEoQXqZgEWOpOkegCEkKFCeDg5UB5QwsA4MAZvKL7azGvEKfzIIB/vczGQ6yEK fleUM0fN4Hq7nJpCNeHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGdY-00049O-CJ; Mon, 09 Dec 2019 10:51:32 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGcd-0003FV-Oo for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 10:50:39 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191209105033euoutp02a1f79af62ac763ce07ecd2d4b7216d0f~erlzS-2373098730987euoutp02Z for ; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191209105033euoutp02a1f79af62ac763ce07ecd2d4b7216d0f~erlzS-2373098730987euoutp02Z 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 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 RhmuCJUJRPyG1wv6XQv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Ro/Pm+QCWKP0bIry S0tSFTLyi0tslaINLYz0DC0t9IxMLPUMjc1jrYxMlfTtbFJSczLLUov07RL0Mtbde8tW0CBZ 8a93A0sD40mRLkZODgkBE4nuvVcYQWwhgaWMEg3zCyHiEhIf199ghbCFJf5c62LrYuQCqvnE KHF00nwmkASbgKPEpKkP2EESIgKdjBLrl01nAnGYBW4wSTRtecfSxcjBISwQJnF3nw9IA4uA qsTXd5+ZQWxeAUuJpbcvsUNskJdYveEAWJxTwEri47Kz7BAXWUrMXbiaBaJeUOLkzCdgI5kF 1CXWzxMCCTMDtTZvnc08gVFwFpKqWQhVs5BULWBkXsUoklpanJueW2ykV5yYW1yal66XnJ+7 iREYmduO/dyyg7HrXfAhRgEORiUeXgWrt7FCrIllxZW5hxglOJiVRHiXTHwVK8SbklhZlVqU H19UmpNafIjRFOi1icxSosn5wKSRVxJvaGpobmFpaG5sbmxmoSTO2yFwMEZIID2xJDU7NbUg 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191209_025035_957068_082E1548 X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: b.zolnierkie@samsung.com, k.konieczny@samsung.com, sw0312.kim@samsung.com, =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , krzk@kernel.org, inki.dae@samsung.com, cw00.choi@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, myungjoo.ham@samsung.com, leonard.crestez@nxp.com, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; From patchwork Mon Dec 9 10:49:01 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: 11279089 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 8E60F930 for ; Mon, 9 Dec 2019 10:51:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D2962073D for ; Mon, 9 Dec 2019 10:51:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ms2ZqPKs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="BWuHDXSk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D2962073D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/8vYse2+jkdKQ5HhnFHI7bGlWvfccRrsqgEG8sKfT/g=; b=ms2ZqPKsAY/ptB sAQnMm2+PkLWiZ5e8oiCOzH1/NhyyUJHABVlI5PqMXtQl6xXufyWWyQJg23Ib4xL8yTfiXavUbGV+ I8/ZU1ziRNvTTtuitSjFIoNit18hIAj0c6oN9dO2o6WHRbVpITs87PCPVCi5T7in8jDudtMb9aRaf S5W9cugAVCbGLZCy6zdI9V/cAu0f3RbuGS9PV1RtMT/W4zjoSxEOBMHewozcfCyTS17UmYtn2BHF/ VsRvj8QzUaOpdKN/sVXMhtrxqcBx/cuX+soOK/zxQ+RurElPt9Aw1qutim4PjjFFGvtzpytW5lPMr cA+LwYylpxGlH4DAShvg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGd5-0003gt-A9; Mon, 09 Dec 2019 10:51:03 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGcd-0003Fa-Oo for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 10:50:38 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191209105034euoutp02cb2ca7bffcdb8e952459f1d972b876c4~erl0Q7zYb3015230152euoutp02h for ; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191209105034euoutp02cb2ca7bffcdb8e952459f1d972b876c4~erl0Q7zYb3015230152euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1575888634; bh=XF8b5+RnbnhvUODeVp5HfzGOMbNt2Uj0dVL4oFNxQD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWuHDXSkim8+164MbWhbz+opMZdTxOfFu62PmTn06xVW3RQ9Km//65hFf9Co1Navd dpvJWW2E0LfBD/pMTChFTmyTpzfm6OJBaYEoHpgRs/uuuWNp9I4tMbfHdNnXhSaBpg Usx5qE4Ic6fd3gOibvLho/KDC1WHv/SvI8PcSdTQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191209105034eucas1p182d3b8056147576e49af062c3919dc42~erlz9utCS1563615636eucas1p1G; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 74.2E.60679.9F62EED5; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20191209105033eucas1p21ee8064e1d6917b403c06ee59a97421d~erlzZV7pJ1406714067eucas1p2_; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191209105033eusmtrp1b10bcfaaad3446502feccb2d4131fc53~erlzYiNOv2135321353eusmtrp1f; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-53-5dee26f9056f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 62.D6.08375.9F62EED5; Mon, 9 Dec 2019 10:50:33 +0000 (GMT) Received: from AMDC3555.digital.local (unknown [106.120.51.67]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191209105032eusmtip1b54a778cfa047ee0e5a7c514ea187ef6~erlyoGs7e3003930039eusmtip1i; Mon, 9 Dec 2019 10:50:32 +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 Subject: [PATCH v3 3/4] devfreq: exynos-bus: Change goto-based logic to if-else logic Date: Mon, 9 Dec 2019 11:49:01 +0100 Message-Id: <20191209104902.11904-4-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: H4sIAAAAAAAAA02SfUhTURjGO7u7291odp2Wr1pWCwXFND+om0kkFIwoqb8KwWrpTSWntutH VpAaikqZKaWuUqupQ8mPZX6SqalDxebMtLIxSSW/ZU2INCq3a+V/zznv8/zO+8AhMHEP7kRE xcTTihhZtIQn5Db0/Hi7d8VtMXRfSQBlLE5HVF1hDU6NLn/FqTxjLpcq/VaIU3cn5jBKp6vl UwNp83xKbTDhlGZiBKfetTziUeY7XYgq1LVxqOddBj41lqrmUYX5M7wjpFRTmcWTvlDdlNYt NnGkOfWVSGrWuJzCQ4SB4XR0VCKt8D58QRg5MHsjbkZwdXq1gZOCjPxsJCCA9AdDzSCWjYSE mFQjaMg1rx+WEbSXjeIWl5g0Ixgu8clGhDXR/TmW9VQgyJyv5/4LLGXMWbE8Mgjy7o/zLQN7 Mh2BXvfRisXIPg5MZ6RZsXbkGSj7YuJZsFzSFZZWkOVaRB4ElekBh91vJ1TVtmMWLSADwFQ+ wGc9ttBbNMm1aGzNc+vlQysfyBk+dCirERs+Cip9Ac5qO5jV1q+X3g79+be5rGZgqtmIs+EU BJryLowdHII3Wj1uWQ4j3aGmxZutHwStJndW2sCHBVt2BRvIayjA2GsRZGaIWSmBliIbFgeQ VjWyjpaC9tUkykW7lRu6KDd0Uf5/tRRhlciBTmDkETTjG0MneTEyOZMQE+EVFivXoLXf1f9L u9yEWn5e7EQkgSSbRbsCFkLFuCyRSZZ3IiAwib1IdW82VCwKlyVfoxWx5xUJ0TTTiZwJrsRB 5Pd0JlRMRsji6cs0HUcr/k45hMApBQmj1cE5j+2Lf59z7H/dO6Y8bq9TrVZecTVuC9qqV2e4 7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YfDVKqiDtqcvdaoosRSnJFoqMVcVJwIAExjXRTh AgAA X-CMS-MailID: 20191209105033eucas1p21ee8064e1d6917b403c06ee59a97421d X-Msg-Generator: CA X-RootMTR: 20191209105033eucas1p21ee8064e1d6917b403c06ee59a97421d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191209105033eucas1p21ee8064e1d6917b403c06ee59a97421d References: <20191209104902.11904-1-a.swigon@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191209_025035_949750_2E54C51B X-CRM114-Status: GOOD ( 13.63 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: b.zolnierkie@samsung.com, k.konieczny@samsung.com, sw0312.kim@samsung.com, =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , krzk@kernel.org, inki.dae@samsung.com, cw00.choi@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, myungjoo.ham@samsung.com, leonard.crestez@nxp.com, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch improves code readability by changing the following construct: > if (cond) > goto passive; > foo(); > goto out; > passive: > bar(); > out: into this: > if (cond) > bar(); > else > foo(); Signed-off-by: Artur Świgoń --- drivers/devfreq/exynos-bus.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 19d9f9f8ced2..0b557df63666 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -427,19 +427,13 @@ static int exynos_bus_probe(struct platform_device *pdev) goto err_reg; if (passive) - goto passive; + ret = exynos_bus_profile_init_passive(bus, profile); + else + ret = exynos_bus_profile_init(bus, profile); - ret = exynos_bus_profile_init(bus, profile); if (ret < 0) goto err; - goto out; -passive: - ret = exynos_bus_profile_init_passive(bus, profile); - if (ret < 0) - goto err; - -out: max_state = bus->devfreq->profile->max_state; min_freq = (bus->devfreq->profile->freq_table[0] / 1000); max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000); From patchwork Mon Dec 9 10:49:02 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: 11279091 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 1EA03930 for ; Mon, 9 Dec 2019 10:51:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1DDA2073D for ; Mon, 9 Dec 2019 10:51:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Th0gmMCb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="rGRnQ+Nb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1DDA2073D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m4azK0zBfYpgPEjuQbw+DVdtzYNkuT6WEr3KEli+R7Y=; b=Th0gmMCbSsV0kC WPwTz73Pdgj1c4Ors/z65nIfT+r2Cdu+QhJJCt8pBU8w0/CDI+3hc+sHGW0ZWcJzUljkxpHwvapUz wyq6xIt1HIq8krSLFNRhUk6LhiGkexBlPRB4w2ZLD35QgjXwGZnCfrG7L0R0mkBJMfVOEQq+y8CnR W4r7Jii9fjoLPxGbvUu4/VFan/G+Tf+a5cTLnjWlfS73CKwd/k0XRytuq9ASqvCr1gHVzm1hay8zI Oey/KipuRvT3agw6pbrpXKH0SP/Ow9IwyNpGGFdzF88TBfdVAIYvKOEELoaVVBGgJnUvVkBL3FQU3 fjlNQWNp2oJpxFZPpLEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGdO-0003xI-Es; Mon, 09 Dec 2019 10:51:22 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieGce-0003Fe-DQ for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2019 10:50:38 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191209105035euoutp026882a4b28f9822bc76f13360289de116~erl08pko03015230152euoutp02i for ; Mon, 9 Dec 2019 10:50:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191209105035euoutp026882a4b28f9822bc76f13360289de116~erl08pko03015230152euoutp02i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1575888635; bh=Ja3gxgbWiIno/jQbE71t1xooMh1ElJexvm3uTQFKFYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGRnQ+Nb6s/Co/D7UnNQSntRcKIKCK9TnER9jju2tVmDAqW6GjLrqduOfiCjwAAxn r48RUacudmSlFOv+eD4BONjENT5m4PI5AQ67hxtFkYQbxobPYhWtsXuDXxzdDjnTRR 3jr8CUNOfs7jrJdXpQqnkr2WHSIbCpLS0tLxNXUk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191209105034eucas1p2ee909cef6b7239aa10fb33712f87b19e~erl0uA_SW1399213992eucas1p2N; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.34.60698.AF62EED5; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20191209105034eucas1p277be9a40363fec76b4241d28e71e40d2~erl0O_90z1387713877eucas1p2u; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191209105034eusmtrp1674e6c1a4c4875d11f1bf7f66b9aab5b~erl0OQCyX2135321353eusmtrp1g; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-8b-5dee26fadb03 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 73.D6.08375.AF62EED5; Mon, 9 Dec 2019 10:50:34 +0000 (GMT) Received: from AMDC3555.digital.local (unknown [106.120.51.67]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191209105033eusmtip143f04464169d159795fb3db34fe9e493~erlzZqZz53014230142eusmtip1M; Mon, 9 Dec 2019 10:50:33 +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 Subject: [PATCH v3 4/4] devfreq: exynos-bus: Clean up code Date: Mon, 9 Dec 2019 11:49:02 +0100 Message-Id: <20191209104902.11904-5-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: H4sIAAAAAAAAA01SaUhUYRTlm/fezFMae46CV4vMIY0WtbAfXxqV5Y+BCvJXlGiN+XIkN+a5 pGVuKOWWjphLIeKI2pioo4kLSOqU2SCTSC6IaWpuqamjoRKW47Py37n3nHPvPR8fTUj0lB0d FBrBKkPlwVKhOdn4fsPgvOm06Huq6+tJPFqcgnBdQQ2FB1anKawazSZxyUoBhZ9NfCewwVAr wj1J8yJcObJMYe1EP4X7Wl4KsTFTh3CBoU2Aq3UjIjycWCnEBbmzwouMTKt5KpTVl8XL6hab BLKsBg2SGbWHrlO3zM8FsMFBUazS9fwdc8Wcvp4Kzzr6QJWupRLQJ/s0ZEYDcwYMSw2CNGRO S5hKBI2bKRRfrCIoLtbsMkYErXn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2SwC qhKfDz8As3kFLCXevV8DtU5eYvWGA8wgNidQ/cdlZ9lBbCGgmrkLV0PVC0qcnPmEBeRsZgF1 ifXzhEDCzECtzVtnM09gFJyFpGoWQtUsJFULGJlXMYqklhbnpucWG+oVJ+YWl+al6yXn525i BMbmtmM/N+9gvLQx+BCjAAejEg9vhc3bWCHWxLLiytxDjBIczEoivEsmvooV4k1JrKxKLcqP LyrNSS0+xGgK9NpEZinR5Hxg2sgriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2aWpBa BNPHxMEp1cDoyXbx5a3PjC+WM26sC9/yver75HdTZU41W77UVREq659xY2rmp1uBwuefmKd4 vG1K6L/WuHqCe7WrDpNg0dUdFbuWbKoI6+sOvHXoumpxwJkltpfD4yyE5y/pnM7uwWZesu71 uq+Mq0//fxLeOeuWg66K/q9bZx7/+/N101mOu9obptU7yjLvVmIpzkg01GIuKk4EAEuOt0Dj AgAA X-CMS-MailID: 20191209105034eucas1p277be9a40363fec76b4241d28e71e40d2 X-Msg-Generator: CA X-RootMTR: 20191209105034eucas1p277be9a40363fec76b4241d28e71e40d2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191209105034eucas1p277be9a40363fec76b4241d28e71e40d2 References: <20191209104902.11904-1-a.swigon@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191209_025036_586538_8B6109B6 X-CRM114-Status: GOOD ( 16.97 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: b.zolnierkie@samsung.com, k.konieczny@samsung.com, sw0312.kim@samsung.com, =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , krzk@kernel.org, inki.dae@samsung.com, cw00.choi@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, myungjoo.ham@samsung.com, leonard.crestez@nxp.com, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds minor improvements to the exynos-bus driver, including cleaning up header includes, variables, and return paths. Signed-off-by: Artur Świgoń --- drivers/devfreq/exynos-bus.c | 56 +++++++++++++++--------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 0b557df63666..3eb6a043284a 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -15,11 +15,10 @@ #include #include #include -#include +#include #include #include #include -#include #define DEFAULT_SATURATION_RATIO 40 @@ -178,7 +177,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np, struct device *dev = bus->dev; struct opp_table *opp_table; const char *vdd = "vdd"; - int i, ret, count, size; + int i, ret, count; opp_table = dev_pm_opp_set_regulators(dev, &vdd, 1); if (IS_ERR(opp_table)) { @@ -201,8 +200,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np, } bus->edev_count = count; - size = sizeof(*bus->edev) * count; - bus->edev = devm_kzalloc(dev, size, GFP_KERNEL); + bus->edev = devm_kcalloc(dev, count, sizeof(*bus->edev), GFP_KERNEL); if (!bus->edev) { ret = -ENOMEM; goto err_regulator; @@ -301,10 +299,9 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, profile->exit = exynos_bus_exit; ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL); - if (!ondemand_data) { - ret = -ENOMEM; - goto err; - } + if (!ondemand_data) + return -ENOMEM; + ondemand_data->upthreshold = 40; ondemand_data->downdifferential = 5; @@ -314,15 +311,14 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, ondemand_data); if (IS_ERR(bus->devfreq)) { dev_err(dev, "failed to add devfreq device\n"); - ret = PTR_ERR(bus->devfreq); - goto err; + return PTR_ERR(bus->devfreq); } /* 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; + return ret; } /* @@ -332,17 +328,16 @@ static int exynos_bus_profile_init(struct exynos_bus *bus, ret = exynos_bus_enable_edev(bus); if (ret < 0) { dev_err(dev, "failed to enable devfreq-event devices\n"); - goto err; + return ret; } ret = exynos_bus_set_event(bus); if (ret < 0) { dev_err(dev, "failed to set event to devfreq-event devices\n"); - goto err; + return ret; } -err: - return ret; + return 0; } static int exynos_bus_profile_init_passive(struct exynos_bus *bus, @@ -351,7 +346,6 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus, 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; @@ -359,30 +353,26 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus, /* 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; - } + if (IS_ERR(parent_devfreq)) + return -EPROBE_DEFER; passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); - if (!passive_data) { - ret = -ENOMEM; - goto err; - } + if (!passive_data) + return -ENOMEM; + 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, + 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; + return PTR_ERR(bus->devfreq); } -err: - return ret; + return 0; } static int exynos_bus_probe(struct platform_device *pdev) @@ -400,18 +390,18 @@ static int exynos_bus_probe(struct platform_device *pdev) return -EINVAL; } - bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); + bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); if (!bus) return -ENOMEM; mutex_init(&bus->lock); - bus->dev = &pdev->dev; + bus->dev = dev; platform_set_drvdata(pdev, bus); profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); if (!profile) return -ENOMEM; - node = of_parse_phandle(dev->of_node, "devfreq", 0); + node = of_parse_phandle(np, "devfreq", 0); if (node) { of_node_put(node); passive = true;