LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 09/13] fsl_soc: Factor fsl_get_bus_freq() out of the wdt init.
Date: Wed, 9 May 2007 22:36:33 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0705092233070.29512@localhost.localdomain> (raw)
In-Reply-To: <20070507182953.GH26920@ld0162-tx32.am.freescale.net>

On Mon, 7 May 2007, Scott Wood wrote:

> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
>  arch/powerpc/sysdev/fsl_soc.c |   44 ++++++++++++++++++++++------------------
>  arch/powerpc/sysdev/fsl_soc.h |    1 +
>  2 files changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index 8a123c7..3b99433 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -64,6 +64,27 @@ phys_addr_t get_immrbase(void)
>
>  EXPORT_SYMBOL(get_immrbase);
>
> +u32 fsl_get_bus_freq(void)

Can we call this something more explicit, like fsl_get_sys_freq().
Otherwise this looks fine.

> +{
> +	struct device_node *soc = of_find_node_by_type(NULL, "soc");
> +	const u32 *freq;
> +	u32 ret = 0;
> +
> +	if (!soc)
> +		goto err;
> +
> +	freq = of_get_property(soc, "bus-frequency", NULL);
> +	if (!freq)
> +		goto err;
> +
> +	ret = *freq;
> +
> +err:
> +	of_node_put(soc);
> +	return ret;
> +}
> +EXPORT_SYMBOL(fsl_get_bus_freq);
> +
>  #if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
>
>  static u32 brgfreq = -1;
> @@ -356,9 +377,9 @@ arch_initcall(fsl_i2c_of_init);
>  static int __init mpc83xx_wdt_init(void)
>  {
>  	struct resource r;
> -	struct device_node *soc, *np;
> +	struct device_node *np;
>  	struct platform_device *dev;
> -	const unsigned int *freq;
> +	u32 freq = fsl_get_bus_freq();
>  	int ret;
>
>  	np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
> @@ -368,19 +389,6 @@ static int __init mpc83xx_wdt_init(void)
>  		goto nodev;
>  	}
>
> -	soc = of_find_node_by_type(NULL, "soc");
> -
> -	if (!soc) {
> -		ret = -ENODEV;
> -		goto nosoc;
> -	}
> -
> -	freq = of_get_property(soc, "bus-frequency", NULL);
> -	if (!freq) {
> -		ret = -ENODEV;
> -		goto err;
> -	}
> -
>  	memset(&r, 0, sizeof(r));
>
>  	ret = of_address_to_resource(np, 0, &r);
> @@ -393,20 +401,16 @@ static int __init mpc83xx_wdt_init(void)
>  		goto err;
>  	}
>
> -	ret = platform_device_add_data(dev, freq, sizeof(int));
> +	ret = platform_device_add_data(dev, &freq, sizeof(int));
>  	if (ret)
>  		goto unreg;
>
> -	of_node_put(soc);
>  	of_node_put(np);
> -
>  	return 0;
>
>  unreg:
>  	platform_device_unregister(dev);
>  err:
> -	of_node_put(soc);
> -nosoc:
>  	of_node_put(np);
>  nodev:
>  	return ret;
> diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
> index 04e145b..7a9502d 100644
> --- a/arch/powerpc/sysdev/fsl_soc.h
> +++ b/arch/powerpc/sysdev/fsl_soc.h
> @@ -7,6 +7,7 @@
>  extern phys_addr_t get_immrbase(void);
>  extern u32 get_brgfreq(void);
>  extern u32 get_baudrate(void);
> +extern u32 fsl_get_bus_freq(void);
>
>  #endif
>  #endif
>

  reply	other threads:[~2007-05-10  3:40 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-07 18:29 [PATCH 01/13] Clean up formatting in Documentation/booting-without-of.txt Scott Wood
2007-05-07 18:29 ` [PATCH 02/13] Document devtree binding for power management controllers Scott Wood
2007-05-08  0:19   ` David Gibson
2007-05-07 18:29 ` [PATCH 03/13] Document the sleep property Scott Wood
2007-05-08  2:11   ` Olof Johansson
2007-05-08 15:23     ` Scott Wood
2007-05-07 18:29 ` [PATCH 04/13] Document the devtree binding for general purpose timers Scott Wood
2007-05-07 18:29 ` [PATCH 05/13] Document the fsl, magic-packet property in gianfar nodes Scott Wood
2007-05-07 21:27   ` Andy Fleming
2007-05-07 21:29     ` Scott Wood
2007-05-07 21:51       ` Andy Fleming
2007-05-07 23:06         ` Kumar Gala
2007-05-08  0:18           ` David Gibson
2007-05-09 14:33             ` Segher Boessenkool
2007-05-09 18:26               ` Scott Wood
2007-05-10  6:57                 ` Segher Boessenkool
2007-05-08 15:29           ` Scott Wood
2007-05-07 18:29 ` [PATCH 06/13] Make swsusp_32.S usable for suspend-to-RAM Scott Wood
2007-05-07 18:29 ` [PATCH 07/13] Implement arch disable/enable irq hooks Scott Wood
2007-05-21 15:55   ` Johannes Berg
2007-05-22  7:14     ` Benjamin Herrenschmidt
2007-05-22  9:03       ` Johannes Berg
2007-05-22  9:15         ` Benjamin Herrenschmidt
2007-05-22  9:24           ` Johannes Berg
2007-05-07 18:29 ` [PATCH 08/13] pm: Handle HID0_SLEEP in the TLF_NAPPING hack Scott Wood
2007-05-07 18:29 ` [PATCH 09/13] fsl_soc: Factor fsl_get_bus_freq() out of the wdt init Scott Wood
2007-05-10  3:36   ` Kumar Gala [this message]
2007-05-10 15:49     ` Scott Wood
2007-05-10 15:59       ` Kumar Gala
2007-05-07 18:29 ` [PATCH 10/13] mpc83xx: Power Management support Scott Wood
2007-05-22 21:08   ` Guennadi Liakhovetski
2007-05-22 21:16     ` Scott Wood
2007-05-07 18:29 ` [PATCH 11/13] mpc83xx: timer driver for PM wakeup Scott Wood
2007-05-07 18:29 ` [PATCH 12/13] gianfar: Add flags for magic packet and MDIO Scott Wood
2007-05-07 19:52   ` Kumar Gala
2007-05-07 19:54     ` Scott Wood
2007-05-07 20:00       ` Kumar Gala
2007-05-07 21:25       ` Andy Fleming
2007-05-07 21:31         ` Scott Wood
2007-05-07 21:56           ` Andy Fleming
2007-05-07 21:45   ` Andy Fleming
2007-05-07 21:53     ` Scott Wood
2007-05-07 21:59       ` Andy Fleming
2007-05-07 23:11     ` Kumar Gala
2007-05-07 23:36       ` Andy Fleming
2007-05-07 18:30 ` [PATCH 13/13] gianfar: Magic Packet and suspend/resume support Scott Wood
2007-05-08  0:20 ` [PATCH 01/13] Clean up formatting in Documentation/booting-without-of.txt David Gibson

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=Pine.LNX.4.64.0705092233070.29512@localhost.localdomain \
    --to=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=scottwood@freescale.com \
    /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