From patchwork Thu Sep 19 14:22:29 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: 11152653 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 9044C14ED for ; Thu, 19 Sep 2019 14:25:04 +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 6435A214AF for ; Thu, 19 Sep 2019 14:25:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cCFdOrFx"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="DLyi5bDJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6435A214AF 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=3QRdDpLZbrllIUa5RHDQv0CSJgO3iaX3KvmpzXoDXTk=; b=cCFdOrFxtYkqQM d+W4WpYJXQg27xzrZstf0QovQIyTtzzTJaVX9TcqlQLmtz1qMU1mISYOjUDViQWvRFXNPUB2zjIUb mvn1GslyLFOP1FdLqroqWrmP1ayf0AZj5DTGy7VULCAy448ADSUx9hTZG6+wP3mcCNT35/udvM203 gtGG47WbL96P0aT0MetWg0o42bVGNxbLjVmOZwgwmlWUkqMOIjMqEIFmdyckGOeEC/OJYUTMa531T ZG0CDUXkpXbAax2W+MVpL4rjLWejombP4oOCZQTEji9K3NFl57fczE7JZt3LE+go5S9pFAs53z+gW vqTt6mxBqRQ4tlaIqG7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAxMl-0006Ds-Ls; Thu, 19 Sep 2019 14:25:03 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iAxLD-0004Wo-G7 for linux-arm-kernel@lists.infradead.org; Thu, 19 Sep 2019 14:23:29 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190919142326euoutp0152b3ecd30e6233bc27ad2ae059c107b4~F3Pi9kWJ32191721917euoutp01I for ; Thu, 19 Sep 2019 14:23:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190919142326euoutp0152b3ecd30e6233bc27ad2ae059c107b4~F3Pi9kWJ32191721917euoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1568903006; bh=oOfZ6+laMOXh5GfXFPnoq8LTAumrs8RYsN9+Zezp3sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DLyi5bDJQ+walUmvREtb0wAd3C6w1I7EMJePoPhlP1/qIs/GayV1YVJVNoI8R3AWM VBG53qrz6LkGiUTd6YbRhHMfwD1Yan6OkfkS/LXyFoLZvyOuKG9CM+4efnho2pwfDC Js6iiMv9OT4Q+4cs1KVOgZWALy3OCnJNNIiQPmmE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190919142325eucas1p28da7adeb9a17d92b68ff117af505bb7d~F3Pid87qa3077830778eucas1p22; Thu, 19 Sep 2019 14:23:25 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 37.1B.04309.D5F838D5; Thu, 19 Sep 2019 15:23:25 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190919142324eucas1p1638cec2aafbfcaf03cfdfa7d0189143a~F3PhpKc5N0293102931eucas1p1R; Thu, 19 Sep 2019 14:23:24 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190919142324eusmtrp11cbda700507d309e234a9e67168d05e2~F3PhXOw7W0555105551eusmtrp1V; Thu, 19 Sep 2019 14:23:24 +0000 (GMT) X-AuditID: cbfec7f4-ae1ff700000010d5-4f-5d838f5d03ee Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A0.65.04117.C5F838D5; Thu, 19 Sep 2019 15:23:24 +0100 (BST) Received: from AMDC3555.digital.local (unknown [106.120.51.67]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190919142323eusmtip118431cc5357ffe0dbc83832c0e4d758f~F3PgiCxp_3039930399eusmtip1e; Thu, 19 Sep 2019 14:23:23 +0000 (GMT) From: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= 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 Subject: [RFC PATCH v2 04/11] devfreq: exynos-bus: Clean up code Date: Thu, 19 Sep 2019 16:22:29 +0200 Message-Id: <20190919142236.4071-5-a.swigon@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190919142236.4071-1-a.swigon@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRju29m5KB05HgVfNCoHQRe8FAlfV5L6cSKKgkgwhq08XtBN2VHL IlNHZuYllEpdmZKablk6L9kwsbkmYThCMTHNqEQqVGKzC1jWPOvy73mf93me930/PobgJ8lg JlmXIep1mlQV5avscnwfClOXGdSRebM8tjk6aTxVcxHhtsoHJH7pniHxbfsQiUcW5il847GF wuVTV5XY6WylcdPkZxJb3o2SeNh6k8KuEjvClc5eBW6xT9L4VV4ThSsrPlB7/AWL6TIlTIz2 UMLUlQGF0F5/QWib61YIT+Z6FEJphwkJLsvqw0ys7854MTU5S9RH7D7hm9Qya0fpXzacsQzG 5qLJ0CLkwwC3FV4V/1QWIV+G55oQtLcuegs3AvOzW6RcuBDU2T5SRYhZtvQtaGT+LoKZ1uuK vw6Dow55cikuGsqvvaE9jUDOjqCidn45l+DqFVBqdBIeVQC3B9xDbtoTq+TWgWHwgIdmOQzX Lt+h5QXXgLm1b1nuw20Dd+9tpazxh2dV75cx8Vtj6DQSnnzgLjJQavpByuZ98GKpxhsUAB8H Orx4FQxWFCtlLMH0oylSNucisDTaCbmxA/oHXpCe5QhuAzywRsh0NIyMVXufwg/GZv3lHfyg vOsGIdMsFBbwMlSBtcpPNgLkm0e92QKUDQ/RV1Fo9X/HVP93TPW/sbWIMKEgMVPSJorSFp14 OlzSaKVMXWL4qTStBf3+dIM/B9zdyLp40oY4BqlWsmtPG9Q8qcmSsrU2BAyhCmRvRuWreTZe k31W1KfF6TNTRcmGQhilKog9t+LNcZ5L1GSIKaKYLur/dBWMT3AuCuloNLiilnadt+tiTAnT E0tHnK/pvq0b128aN/P9/k8jChbb7o7npG1v8HOrwhvesfe7Jo4FGC+whWeev/4UY1wsiAmw muMKDx2913IwlO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CABrO2lX1AgAA X-CMS-MailID: 20190919142324eucas1p1638cec2aafbfcaf03cfdfa7d0189143a X-Msg-Generator: CA X-RootMTR: 20190919142324eucas1p1638cec2aafbfcaf03cfdfa7d0189143a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190919142324eucas1p1638cec2aafbfcaf03cfdfa7d0189143a References: <20190919142236.4071-1-a.swigon@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190919_072327_700161_37764219 X-CRM114-Status: GOOD ( 17.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.11 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , b.zolnierkie@samsung.com, sw0312.kim@samsung.com, krzk@kernel.org, inki.dae@samsung.com, cw00.choi@samsung.com, myungjoo.ham@samsung.com, leonard.crestez@nxp.com, georgi.djakov@linaro.org, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Artur Świgoń This patch adds minor improvements to the exynos-bus driver. Signed-off-by: Artur Świgoń Reviewed-by: Krzysztof Kozlowski --- drivers/devfreq/exynos-bus.c | 66 ++++++++++++++---------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 60ad4319fd80..8d44810cac69 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,8 +311,7 @@ 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); } /* @@ -325,16 +321,13 @@ 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) { + if (ret < 0) dev_err(dev, "failed to set event to devfreq-event devices\n"); - goto err; - } -err: return ret; } @@ -344,7 +337,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; @@ -352,30 +344,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) @@ -393,18 +381,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; @@ -461,12 +449,10 @@ static int exynos_bus_resume(struct device *dev) int ret; ret = exynos_bus_enable_edev(bus); - if (ret < 0) { + if (ret < 0) dev_err(dev, "failed to enable the devfreq-event devices\n"); - return ret; - } - return 0; + return ret; } static int exynos_bus_suspend(struct device *dev) @@ -475,12 +461,10 @@ static int exynos_bus_suspend(struct device *dev) int ret; ret = exynos_bus_disable_edev(bus); - if (ret < 0) { + if (ret < 0) dev_err(dev, "failed to disable the devfreq-event devices\n"); - return ret; - } - return 0; + return ret; } #endif