mirror of https://gitee.com/openkylin/linux.git
powerpc/fsl_soc: improve and simplify get_baudrate
Use of_property_read_u32 instead of the generic of_get_property to simplify the code. In addition move the declaration of fs_baudrate into get_baudrate because it's private to this function. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Scott Wood <oss@buserror.net>
This commit is contained in:
parent
47a48a9210
commit
0f236988e9
|
@ -136,10 +136,9 @@ u32 get_brgfreq(void)
|
||||||
|
|
||||||
EXPORT_SYMBOL(get_brgfreq);
|
EXPORT_SYMBOL(get_brgfreq);
|
||||||
|
|
||||||
static u32 fs_baudrate = -1;
|
|
||||||
|
|
||||||
u32 get_baudrate(void)
|
u32 get_baudrate(void)
|
||||||
{
|
{
|
||||||
|
static u32 fs_baudrate = -1;
|
||||||
struct device_node *node;
|
struct device_node *node;
|
||||||
|
|
||||||
if (fs_baudrate != -1)
|
if (fs_baudrate != -1)
|
||||||
|
@ -147,12 +146,7 @@ u32 get_baudrate(void)
|
||||||
|
|
||||||
node = of_find_node_by_type(NULL, "serial");
|
node = of_find_node_by_type(NULL, "serial");
|
||||||
if (node) {
|
if (node) {
|
||||||
int size;
|
of_property_read_u32(node, "current-speed", &fs_baudrate);
|
||||||
const unsigned int *prop = of_get_property(node,
|
|
||||||
"current-speed", &size);
|
|
||||||
|
|
||||||
if (prop)
|
|
||||||
fs_baudrate = *prop;
|
|
||||||
of_node_put(node);
|
of_node_put(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue