Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp12052037ybi; Fri, 26 Jul 2019 04:02:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3yHwnEmYQL4mxoM2WjuXNLWm5tSxkXTKO/SodOYFoWuVxV1kfolfk8pBkHOD3HV1JlnKW X-Received: by 2002:a65:4c4d:: with SMTP id l13mr49695774pgr.156.1564138950450; Fri, 26 Jul 2019 04:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564138950; cv=none; d=google.com; s=arc-20160816; b=Yz26BO90EAQynnYUYqDi05kKUYVgMgdaSW3bLjOGkejXpSB2eM+axwNOzdM+hhuGq9 yes594EFqEqdCEJ2wxTg3RzSgwiEh5wfBdH7mBUSRGGhJenu4GnMNDOfq4AC7iVy706/ yoaG+7FRY08ZFKURe8oGmcoprV8Ly7DWBAHVYTF2TYhxdP30mOOq8qA//R3Sf6WfDqgT yi0VPvzHZN4uMn1ZZqzLyxx127aQPGHnNCw4GW4JE4Y55PLBOMRX8otBO+a79Lor0+oN G5P6ckmsMApHf5rXvec+gRmF6HRa811ESrtgQQlvYVdDhZ34bxx41tGD+G0uJ30jO759 KnCw== 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:in-reply-to:references:mime-version :dkim-signature; bh=obV9bYwNGWBQ367WwfoDDrtUjYrPhKyHWLQH1osJp6s=; b=c82FC9KU7qkATXmGAAK6s3G+kShtpMCXUiBwBzUdMpGMNfz+MMXWC3WrnfdZiZC4eg E6wLPz0o47GPX8MoKLt7zuxOXWFJFxPYWWqgC+luQn/7oNnIZpBED6RD54QEV/4Qz+N6 sBRsOPTaTMC526Ia1GmwXLSGhoUxzQCsx6eyZ9eGT/BHK5n7DwEsLx7iUio6Trib/h0m UwdZXRAp01lmmQOEZX7zvvwhqUnKofZB7duWeWWjRPPVVnJXRRsz43hvX068Wv7Z+30Y OXF9FfzTmIXiHT/3L/abiSQ7zjHS8dSa6c1gq33W8dmdU1HoE/FX3qjpc+maDYMFC6Ys ZUfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xOIT7hQd; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15si18924823pgy.517.2019.07.26.04.02.14; Fri, 26 Jul 2019 04:02:30 -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=@kernel.org header.s=default header.b=xOIT7hQd; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbfGZKmT (ORCPT + 99 others); Fri, 26 Jul 2019 06:42:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbfGZKmT (ORCPT ); Fri, 26 Jul 2019 06:42:19 -0400 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2142122CB9; Fri, 26 Jul 2019 10:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564137737; bh=X7zomnphSoatQ2ExsZCymGrIKUnr+7mD1sl02mTPfh4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=xOIT7hQdaE/9saCJ016SORI9yKJR4VdvxCbG1H173OLs1s6mHJXKyd7rc897GqvTd gKGbYk2M0FXGKg+ThrcP47kYqY52jrdZIUTa1y2tkWazRdgbUglzRXmdiVxFD9JWf4 /rjQ/hqg3pM0VOSD8zR3w9k9kqGBqh95ky+LeizI= Received: by mail-lj1-f181.google.com with SMTP id r9so51018570ljg.5; Fri, 26 Jul 2019 03:42:17 -0700 (PDT) X-Gm-Message-State: APjAAAVDXb0Q5x4XbONwUkcsxIi2/ifvFlxLaIxo3aYUjeskf/uI71Ho 8v35IMSOwEap4g5K8BGskqPXEgimI6tnZ65E+RI= X-Received: by 2002:a2e:b4d4:: with SMTP id r20mr23905543ljm.5.1564137735265; Fri, 26 Jul 2019 03:42:15 -0700 (PDT) MIME-Version: 1.0 References: <20190723122016.30279-1-a.swigon@partner.samsung.com> <20190723122016.30279-2-a.swigon@partner.samsung.com> In-Reply-To: From: Krzysztof Kozlowski Date: Fri, 26 Jul 2019 12:42:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 01/11] devfreq: exynos-bus: Extract exynos_bus_profile_init() To: cwchoi00@gmail.com Cc: =?UTF-8?B?QXJ0dXIgxZp3aWdvxYQ=?= , devicetree , linux-arm-kernel , linux-samsung-soc , linux-kernel , Linux PM list , dri-devel , Chanwoo Choi , MyungJoo Ham , Inki Dae , 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 On Thu, 25 Jul 2019 at 14:44, Chanwoo Choi wrote: > > 2019=EB=85=84 7=EC=9B=94 24=EC=9D=BC (=EC=88=98) =EC=98=A4=EC=A0=84 8:09,= Artur =C5=9Awigo=C5=84 =EB=8B=98=EC=9D=B4 = =EC=9E=91=EC=84=B1: > > > > This patch adds a new static function, exynos_bus_profile_init(), extra= cted > > from exynos_bus_probe(). > > > > Signed-off-by: Artur =C5=9Awigo=C5=84 > > --- > > 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 =3D bus->dev; > > + struct devfreq_simple_ondemand_data *ondemand_data; > > + int ret; > > + > > + /* Initialize the struct profile and governor data for parent d= evice */ > > + profile->polling_ms =3D 50; > > + profile->target =3D exynos_bus_target; > > + profile->get_dev_status =3D exynos_bus_get_dev_status; > > + profile->exit =3D exynos_bus_exit; > > + > > + ondemand_data =3D devm_kzalloc(dev, sizeof(*ondemand_data), GFP= _KERNEL); > > + if (!ondemand_data) { > > + ret =3D -ENOMEM; > > + goto err; > > + } > > + ondemand_data->upthreshold =3D 40; > > + ondemand_data->downdifferential =3D 5; > > + > > + /* Add devfreq device to monitor and handle the exynos bus */ > > + bus->devfreq =3D devm_devfreq_add_device(dev, profile, > > + DEVFREQ_GOV_SIMPLE_ONDE= MAND, > > + ondemand_data); > > + if (IS_ERR(bus->devfreq)) { > > + dev_err(dev, "failed to add devfreq device\n"); > > + ret =3D PTR_ERR(bus->devfreq); > > + goto err; > > + } > > + > > + /* 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; > > + } > > + > > + /* > > + * Enable devfreq-event to get raw data which is used to determ= ine > > + * current bus load. > > + */ > > + ret =3D exynos_bus_enable_edev(bus); > > + if (ret < 0) { > > + dev_err(dev, "failed to enable devfreq-event devices\n"= ); > > + goto err; > > + } > > + > > + ret =3D exynos_bus_set_event(bus); > > + if (ret < 0) { > > + dev_err(dev, "failed to set event to devfreq-event devi= ces\n"); > > + goto err; > > + } > > + > > +err: > > + return ret; > > +} > > + > > static int exynos_bus_probe(struct platform_device *pdev) > > { > > struct device *dev =3D &pdev->dev; > > struct device_node *np =3D 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 d= evice */ > > - profile->polling_ms =3D 50; > > - profile->target =3D exynos_bus_target; > > - profile->get_dev_status =3D exynos_bus_get_dev_status; > > - profile->exit =3D exynos_bus_exit; > > - > > - ondemand_data =3D devm_kzalloc(dev, sizeof(*ondemand_data), GFP= _KERNEL); > > - if (!ondemand_data) { > > - ret =3D -ENOMEM; > > + ret =3D exynos_bus_profile_init(bus, profile); > > + if (ret < 0) > > goto err; > > - } > > - ondemand_data->upthreshold =3D 40; > > - ondemand_data->downdifferential =3D 5; > > - > > - /* Add devfreq device to monitor and handle the exynos bus */ > > - bus->devfreq =3D devm_devfreq_add_device(dev, profile, > > - DEVFREQ_GOV_SIMPLE_ONDE= MAND, > > - ondemand_data); > > - if (IS_ERR(bus->devfreq)) { > > - dev_err(dev, "failed to add devfreq device\n"); > > - ret =3D PTR_ERR(bus->devfreq); > > - goto err; > > - } > > - > > - /* 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; > > - } > > - > > - /* > > - * Enable devfreq-event to get raw data which is used to determ= ine > > - * current bus load. > > - */ > > - ret =3D exynos_bus_enable_edev(bus); > > - if (ret < 0) { > > - dev_err(dev, "failed to enable devfreq-event devices\n"= ); > > - goto err; > > - } > > - > > - ret =3D exynos_bus_set_event(bus); > > - if (ret < 0) { > > - dev_err(dev, "failed to set event to devfreq-event devi= ces\n"); > > - goto err; > > - } > > > > goto out; > > passive: > > -- > > 2.17.1 > > > > NACK. > > It has not any benefit and I don't understand reason why it is necessary. > I don't agree. Please drop it. The probe has 12 local variables and around 140 lines of code (so much more than coding style recommendations). Therefore splitting some logical part out of probe to make code better organized and more readable is pretty obvious benefit. Best regards, Krzysztof