Commit dbecd509 authored by Gavin Shan's avatar Gavin Shan Committed by Michael Ellerman

powerpc/kernel: Remove nested if statements in rtas_initialize()

This removes the unnecessary nested if statements in function
rtas_initialize(), to simplify the code. No functional changes
introduced.
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent fb37e128
...@@ -1145,31 +1145,30 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs) ...@@ -1145,31 +1145,30 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
void __init rtas_initialize(void) void __init rtas_initialize(void)
{ {
unsigned long rtas_region = RTAS_INSTANTIATE_MAX; unsigned long rtas_region = RTAS_INSTANTIATE_MAX;
const __be32 *basep, *entryp, *sizep;
/* Get RTAS dev node and fill up our "rtas" structure with infos /* Get RTAS dev node and fill up our "rtas" structure with infos
* about it. * about it.
*/ */
rtas.dev = of_find_node_by_name(NULL, "rtas"); rtas.dev = of_find_node_by_name(NULL, "rtas");
if (rtas.dev) {
const __be32 *basep, *entryp, *sizep;
basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
sizep = of_get_property(rtas.dev, "rtas-size", NULL);
if (basep != NULL && sizep != NULL) {
rtas.base = __be32_to_cpu(*basep);
rtas.size = __be32_to_cpu(*sizep);
entryp = of_get_property(rtas.dev,
"linux,rtas-entry", NULL);
if (entryp == NULL) /* Ugh */
rtas.entry = rtas.base;
else
rtas.entry = __be32_to_cpu(*entryp);
} else
rtas.dev = NULL;
}
if (!rtas.dev) if (!rtas.dev)
return; return;
basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
sizep = of_get_property(rtas.dev, "rtas-size", NULL);
if (basep == NULL || sizep == NULL) {
rtas.dev = NULL;
return;
}
rtas.base = __be32_to_cpu(*basep);
rtas.size = __be32_to_cpu(*sizep);
entryp = of_get_property(rtas.dev, "linux,rtas-entry", NULL);
if (entryp == NULL) /* Ugh */
rtas.entry = rtas.base;
else
rtas.entry = __be32_to_cpu(*entryp);
/* If RTAS was found, allocate the RMO buffer for it and look for /* If RTAS was found, allocate the RMO buffer for it and look for
* the stop-self token if any * the stop-self token if any
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment