Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10917759ybi; Thu, 25 Jul 2019 07:04:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFZRLGxah9rjM3/LO+7uMmmZnQHgMvs7n6PeR8TnbxHPEqqr+VZIProxtLfbVfEc8f9WOe X-Received: by 2002:a17:90a:c68c:: with SMTP id n12mr94510535pjt.29.1564063451478; Thu, 25 Jul 2019 07:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564063451; cv=none; d=google.com; s=arc-20160816; b=KH21KQQT4tZpqj+HPhDcUDzH1Cczn1lmUsc4thAJSlSoT9cOdQ1F/Y8ynPpNU7jodF PUqJoBc8/s30Mb962SM2Ne8Tkp9tCKH+uOP4nKilnFuJVtiLg6J5zo4uu0Grg1BrDfN0 gUkruG9DmPMNeTJ/2IR3BKqdHiTr7JZP7FAPuQ22KzMfQfVpGQjykMGZGU87m8djmxYn 0EYCFyCmLCOeWXHJblykMY8MDm5vAmGAYVhrOyZVE3KkABviXxEr0teZnjmUHp3YGZXt k2WtYxW3hdkNl3E0aOaATvOViEl6yGgyGAZZe/5UogezCNC0R2JCenfHYQAq4zo/uwJa OfTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:reply-to:in-reply-to:references:mime-version :dkim-signature; bh=/Xsj00ljhBsEGtdT+wj7N34Rn+B2eibrc+3bGLHtXVM=; b=I8utxCdEZoTkiibzSiRLoKRlq9aZvI96PCC6E42qjShoDpziL6RS3xCEcV89ARFc1b tVbqTpob2tdF/e7Nd+sUB1755O7KCbyd9h/8VKN6LiMH6jAaR5Qc6vU0cJYl2BneFUto 3gIjx1i2lqA9A/QXC4HQXWS27cmKUWcUU4NuwnVANPNWbP951wisZCXE4TSIO3CjAFjS a1kxq3IXnY+r+mx4u15MNo7A09xh/xW3r+S6Yz3BJD1JhhoM2gNGHam+i7/E3kUAp8jk rxdvTNxOqBGQJyUr7+BmoRn/Ui6LGltZims98CdyB2mYORFRa/Ug3Isxqs45YAyJYHO3 gooQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KrxMTzFA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd11si15359916plb.184.2019.07.25.07.03.55; Thu, 25 Jul 2019 07:04:11 -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=@gmail.com header.s=20161025 header.b=KrxMTzFA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389302AbfGYMve (ORCPT + 99 others); Thu, 25 Jul 2019 08:51:34 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:40955 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388100AbfGYMve (ORCPT ); Thu, 25 Jul 2019 08:51:34 -0400 Received: by mail-lf1-f68.google.com with SMTP id b17so34470432lff.7; Thu, 25 Jul 2019 05:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=/Xsj00ljhBsEGtdT+wj7N34Rn+B2eibrc+3bGLHtXVM=; b=KrxMTzFAhzWFqULF0MbgezdmTCddBLW97aZPw3roEOocGi9PDJFCSZH+TnwulnpeHu 3dXe6bI5xxyAEbMIqJ7cE0SM5Oidx/BetTLPcq2iPyBBaZJUK4Fu316uFx+7yYEtQspd 7Wd9dy9MMx4pEro5eP9OpYcYTFB+yFEDUswcHd8NvJXkH/qh9HqcXpCcPo98DeGgu+Fz yDYtoOYw+cgpWw0MTtZg/sSmqRJkcceW1Rw7N/o+FwuIIM4y7hjxM6d7sVHRcrlWfviM tdoCkMRczvDnAkzxE4hW0IdrhEwqrpzzmBZ/wdXyF8q8+hkBo2kecS8AtzQnc4HOXUYY 4dAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=/Xsj00ljhBsEGtdT+wj7N34Rn+B2eibrc+3bGLHtXVM=; b=ZVT5j4lZyHk5Z290cj99uRQ/hFuvQxsCgrVSyhSPiJCGNkpyrgoJjkAZRyP5dpZT1/ xvl78D10Oy9T9PwldTjVHarvnYvqn6eubZSBFntjLpBZMeS17NUaXlkYsumQ3S1tDMoa ajzNHvwXoEZQRd43Clx1Lxs/IVCDbnLknCwQpYUnrBmraqDu0I0ea9vxCtRlim5uZyZe SEdss2eYWVJgEPtNNHeFiMVS/ZdsfFP7BMZOI3PpQGd/Xxw9ZuynVwgNyf10P0xuc3ox FZQ5bU9Chfm/xeUFOJexF/a1HWxPx1j6aXhd0MQNM6ME8IMUi/OVy5fpcn1ZJwbzmU+S EbeA== X-Gm-Message-State: APjAAAU/W3x1jCfafWxhbgGHssldwjF631wi5GrBr4utXSsmuTGULu4t cb0iZwLSP5tKuWQFtb7dmd/UOSmVnxd8Zl5uXkE= X-Received: by 2002:a19:914c:: with SMTP id y12mr41019898lfj.108.1564059090602; Thu, 25 Jul 2019 05:51:30 -0700 (PDT) MIME-Version: 1.0 References: <20190723122016.30279-1-a.swigon@partner.samsung.com> <20190723122016.30279-5-a.swigon@partner.samsung.com> In-Reply-To: <20190723122016.30279-5-a.swigon@partner.samsung.com> Reply-To: cwchoi00@gmail.com From: Chanwoo Choi Date: Thu, 25 Jul 2019 21:50:53 +0900 Message-ID: Subject: Re: [RFC PATCH 04/11] devfreq: exynos-bus: Clean up code To: =?UTF-8?B?QXJ0dXIgxZp3aWdvxYQ=?= Cc: devicetree , linux-arm-kernel , linux-samsung-soc , linux-kernel , Linux PM list , dri-devel , Krzysztof Kozlowski , Chanwoo Choi , MyungJoo Ham , inki.dae@samsung.com, Seung-Woo Kim , georgi.djakov@linaro.org, Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019=EB=85=84 7=EC=9B=94 24=EC=9D=BC (=EC=88=98) =EC=98=A4=EC=A0=84 8:07, A= rtur =C5=9Awigo=C5=84 =EB=8B=98=EC=9D=B4 =EC= =9E=91=EC=84=B1: > > This patch adds minor improvements to the exynos-bus driver. > > Signed-off-by: Artur =C5=9Awigo=C5=84 > --- > drivers/devfreq/exynos-bus.c | 49 ++++++++++++++++-------------------- > 1 file changed, 22 insertions(+), 27 deletions(-) > > diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c > index 4bb83b945bf7..412511ca7703 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 > #define DEFAULT_VOLTAGE_TOLERANCE 2 > @@ -256,7 +255,7 @@ static int exynos_bus_parent_parse_of(struct device_n= ode *np, > struct exynos_bus *bus) > { > struct device *dev =3D bus->dev; > - int i, ret, count, size; > + int i, ret, count; > > /* Get the regulator to provide each bus with the power */ > bus->regulator =3D devm_regulator_get(dev, "vdd"); > @@ -283,8 +282,7 @@ static int exynos_bus_parent_parse_of(struct device_n= ode *np, > } > bus->edev_count =3D count; > > - size =3D sizeof(*bus->edev) * count; > - bus->edev =3D devm_kzalloc(dev, size, GFP_KERNEL); > + bus->edev =3D devm_kcalloc(dev, count, sizeof(*bus->edev), GFP_KE= RNEL); > if (!bus->edev) { > ret =3D -ENOMEM; > goto err_regulator; > @@ -388,7 +386,7 @@ static int exynos_bus_profile_init(struct exynos_bus = *bus, > ondemand_data =3D devm_kzalloc(dev, sizeof(*ondemand_data), GFP_K= ERNEL); > if (!ondemand_data) { > ret =3D -ENOMEM; > - goto err; > + goto out; > } > ondemand_data->upthreshold =3D 40; > ondemand_data->downdifferential =3D 5; > @@ -400,14 +398,14 @@ static int exynos_bus_profile_init(struct exynos_bu= s *bus, > if (IS_ERR(bus->devfreq)) { > dev_err(dev, "failed to add devfreq device\n"); > ret =3D PTR_ERR(bus->devfreq); > - goto err; > + goto out; > } > > /* Register opp_notifier to catch the change of OPP */ > ret =3D devm_devfreq_register_opp_notifier(dev, bus->devfreq); > if (ret < 0) { > dev_err(dev, "failed to register opp notifier\n"); > - goto err; > + goto out; > } > > /* > @@ -417,16 +415,16 @@ static int exynos_bus_profile_init(struct exynos_bu= s *bus, > ret =3D exynos_bus_enable_edev(bus); > if (ret < 0) { > dev_err(dev, "failed to enable devfreq-event devices\n"); > - goto err; > + goto out; > } > > ret =3D exynos_bus_set_event(bus); > if (ret < 0) { > dev_err(dev, "failed to set event to devfreq-event device= s\n"); > - goto err; > + goto out; > } > > -err: > +out: > return ret; > } > > @@ -446,27 +444,28 @@ static int exynos_bus_profile_init_passive(struct e= xynos_bus *bus, > parent_devfreq =3D devfreq_get_devfreq_by_phandle(dev, 0); > if (IS_ERR(parent_devfreq)) { > ret =3D -EPROBE_DEFER; > - goto err; > + goto out; > } > > passive_data =3D devm_kzalloc(dev, sizeof(*passive_data), GFP_KER= NEL); > if (!passive_data) { > ret =3D -ENOMEM; > - goto err; > + goto out; > } > passive_data->parent =3D parent_devfreq; > > /* Add devfreq device for exynos bus with passive governor */ > - bus->devfreq =3D devm_devfreq_add_device(dev, profile, DEVFREQ_GO= V_PASSIVE, > + bus->devfreq =3D 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 =3D PTR_ERR(bus->devfreq); > - goto err; > + goto out; > } > > -err: > +out: > return ret; > } > > @@ -484,11 +483,11 @@ static int exynos_bus_probe(struct platform_device = *pdev) > return -EINVAL; > } > > - bus =3D devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); > + bus =3D devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); > if (!bus) > return -ENOMEM; > mutex_init(&bus->lock); > - bus->dev =3D &pdev->dev; > + bus->dev =3D dev; > platform_set_drvdata(pdev, bus); > > /* Parse the device-tree to get the resource information */ > @@ -502,7 +501,7 @@ static int exynos_bus_probe(struct platform_device *p= dev) > goto err; > } > > - node =3D of_parse_phandle(dev->of_node, "devfreq", 0); > + node =3D of_parse_phandle(np, "devfreq", 0); > if (node) { > of_node_put(node); > ret =3D exynos_bus_profile_init_passive(bus, profile); > @@ -547,12 +546,10 @@ static int exynos_bus_resume(struct device *dev) > int ret; > > ret =3D 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) > @@ -561,12 +558,10 @@ static int exynos_bus_suspend(struct device *dev) > int ret; > NACK. > ret =3D 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 > > -- > 2.17.1 > NACK. As I already commented, It has never any benefit. I think that it is not usful. Please drop it. --=20 Best Regards, Chanwoo Choi