diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-10-29 17:27:14 +0300 |
---|---|---|
committer | Scott Wood <oss@buserror.net> | 2016-11-23 10:23:36 +0300 |
commit | 5bda6c0eb7cddc9e109c9f79d500288af0704e7a (patch) | |
tree | 09aaed794c0ec0c6330e41763e2f7ad13e6b7bf4 /arch | |
parent | 00b6cfc4c4ee32c6031d1645548f1bf4e6104c45 (diff) | |
download | linux-5bda6c0eb7cddc9e109c9f79d500288af0704e7a.tar.xz |
powerpc/fsl_soc: improve and simplify fsl_get_sys_freq
Use of_property_read_u32 instead of the generic of_get_property to
simplify the code. In addition move the declaration of sysfreq
into fsl_get_sys_freq because it's private to this function.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index d93056eedcb0..48fc36b3851f 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -77,13 +77,10 @@ phys_addr_t get_immrbase(void) EXPORT_SYMBOL(get_immrbase); -static u32 sysfreq = -1; - u32 fsl_get_sys_freq(void) { + static u32 sysfreq = -1; struct device_node *soc; - const u32 *prop; - int size; if (sysfreq != -1) return sysfreq; @@ -92,12 +89,9 @@ u32 fsl_get_sys_freq(void) if (!soc) return -1; - prop = of_get_property(soc, "clock-frequency", &size); - if (!prop || size != sizeof(*prop) || *prop == 0) - prop = of_get_property(soc, "bus-frequency", &size); - - if (prop && size == sizeof(*prop)) - sysfreq = *prop; + of_property_read_u32(soc, "clock-frequency", &sysfreq); + if (sysfreq == -1 || !sysfreq) + of_property_read_u32(soc, "bus-frequency", &sysfreq); of_node_put(soc); return sysfreq; |