devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sudeep.KarkadaNagesha@arm.com
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
	Russell King <linux@arm.linux.org.uk>,
	Shawn Guo <shawn.guo@linaro.org>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Olof Johansson <olof@lixom.net>, Arnd Bergmann <arnd@arndb.de>,
	Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>
Subject: Re: [RFC PATCH v2 11/15] cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu nodes
Date: Wed, 17 Jul 2013 16:43:55 +0200	[thread overview]
Message-ID: <20130717144355.GE1026@lunn.ch> (raw)
In-Reply-To: <1374069984-20567-12-git-send-email-Sudeep.KarkadaNagesha@arm.com>

On Wed, Jul 17, 2013 at 03:06:20PM +0100, Sudeep.KarkadaNagesha@arm.com wrote:
> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> 
> Now that the cpu device registration initialises the of_node(if available)
> appropriately for all the cpus, parsing here is redundant.
> 
> This patch removes all DT parsing and uses cpu->of_node instead.
> 
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
> ---
>  drivers/cpufreq/kirkwood-cpufreq.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> index c233ea6..18aa3eb 100644
> --- a/drivers/cpufreq/kirkwood-cpufreq.c
> +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> @@ -13,6 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/clk.h>
>  #include <linux/clk-provider.h>
> +#include <linux/cpu.h>
>  #include <linux/cpufreq.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> @@ -165,6 +166,7 @@ static struct cpufreq_driver kirkwood_cpufreq_driver = {
>  static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>  {
>  	struct device_node *np;
> +	struct device *cpu_dev;
>  	struct resource *res;
>  	int err;
>  
> @@ -175,9 +177,17 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv.base))
>  		return PTR_ERR(priv.base);
>  
> -	np = of_find_node_by_path("/cpus/cpu@0");
> -	if (!np)
> +	cpu_dev = get_cpu_device(0);
> +	if (!cpu_dev) {
> +		dev_err(&pdev->dev, "failed to get cpu device\n");
>  		return -ENODEV;
> +	}
> +
> +	np = of_node_get(cpu_dev->of_node);
> +	if (!np) {
> +		dev_err(&pdev->dev, "failed to get cpu device node\n");
> +		return -ENODEV;
> +	}

Hi Sudeep

Are we not going a bit backwards here? You are replacing two lines
with 10 lines.

How about putting these 10 lines into some helper,
of_get_cpu_device()?  It would be useful for spear, kirkwood and
imx6q, and maybe others.

    Thanks
	Andrew

  reply	other threads:[~2013-07-17 14:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17 14:06 [RFC PATCH v2 00/15] DT/core: update cpu device of_node Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 02/15] driver/core: cpu: initialize of_node in cpu's device struture Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 03/15] ARM: DT/kernel: define ARM specific arch_match_cpu_phys_id Sudeep.KarkadaNagesha
     [not found] ` <1374069984-20567-1-git-send-email-Sudeep.KarkadaNagesha-5wv7dgnIgG8@public.gmane.org>
2013-07-17 14:06   ` [RFC PATCH v2 01/15] of: add support for retrieving cpu node for a given logical cpu index Sudeep.KarkadaNagesha-5wv7dgnIgG8
     [not found]     ` <1374069984-20567-2-git-send-email-Sudeep.KarkadaNagesha-5wv7dgnIgG8@public.gmane.org>
2013-07-17 14:30       ` Nicolas Pitre
2013-07-17 14:50     ` Rob Herring
2013-07-17 15:18       ` Sudeep KarkadaNagesha
2013-07-17 14:06   ` [RFC PATCH v2 04/15] ARM: topology: remove hwid/MPIDR dependency from cpu_capacity Sudeep.KarkadaNagesha-5wv7dgnIgG8
2013-07-17 14:06   ` [RFC PATCH v2 05/15] ARM: mvebu: remove device tree parsing for cpu nodes Sudeep.KarkadaNagesha-5wv7dgnIgG8
2013-07-17 14:06   ` [RFC PATCH v2 07/15] cpufreq: imx6q-cpufreq: " Sudeep.KarkadaNagesha-5wv7dgnIgG8
2013-07-17 14:06   ` [RFC PATCH v2 08/15] cpufreq: cpufreq-cpu0: " Sudeep.KarkadaNagesha-5wv7dgnIgG8
2013-07-17 14:06 ` [RFC PATCH v2 06/15] drivers/bus: arm-cci: avoid parsing DT for cpu device nodes Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 09/15] cpufreq: highbank-cpufreq: remove device tree parsing for cpu nodes Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 10/15] cpufreq: spear-cpufreq: " Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 11/15] cpufreq: kirkwood-cpufreq: " Sudeep.KarkadaNagesha
2013-07-17 14:43   ` Andrew Lunn [this message]
2013-07-18  7:53     ` Viresh Kumar
2013-07-18  8:24     ` Sudeep KarkadaNagesha
2013-07-18 10:14       ` Sudeep KarkadaNagesha
2013-07-18 18:30         ` Rob Herring
2013-07-17 14:06 ` [RFC PATCH v2 12/15] cpufreq: arm_big_little: " Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 13/15] cpufreq: maple-cpufreq: " Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 14/15] cpufreq: pmac64-cpufreq: " Sudeep.KarkadaNagesha
2013-07-17 14:06 ` [RFC PATCH v2 15/15] cpufreq: pmac32-cpufreq: " Sudeep.KarkadaNagesha
2013-07-18  7:54 ` [RFC PATCH v2 00/15] DT/core: update cpu device of_node Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130717144355.GE1026@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Sudeep.KarkadaNagesha@arm.com \
    --cc=arnd@arndb.de \
    --cc=cpufreq@vger.kernel.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=olof@lixom.net \
    --cc=rjw@sisk.pl \
    --cc=rob.herring@calxeda.com \
    --cc=shawn.guo@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).