Commit e1148e37 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: janitor log_rtas_error() call arguments

This patch from Linas Vepstas (rediffed by me) fixes the confusing argument
aliasing of the log_rtas_error() subroutine.

This patch makes no functional changes, it just cleans up some strange
usage.

The rtas_args used to communicate with firmware are always taken from the
paca struct, so as to keep the args at a fixed, low-memory location.  But
the log_rtas_error() routine also took an rtas_args pointer, which it
assumed was aliased to the paca struct.  This aliasing is both
un-neccessary, and confusing; this patch eliminates this confusion.
Signed-off-by: default avatarLinas Vepstas <linas@linas.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 16b004a7
...@@ -75,9 +75,9 @@ rtas_token(const char *service) ...@@ -75,9 +75,9 @@ rtas_token(const char *service)
static int static int
__log_rtas_error(struct rtas_args *rtas_args) __log_rtas_error(void)
{ {
struct rtas_args err_args, temp_args; struct rtas_args err_args, save_args;
err_args.token = rtas_token("rtas-last-error"); err_args.token = rtas_token("rtas-last-error");
err_args.nargs = 2; err_args.nargs = 2;
...@@ -88,7 +88,7 @@ __log_rtas_error(struct rtas_args *rtas_args) ...@@ -88,7 +88,7 @@ __log_rtas_error(struct rtas_args *rtas_args)
err_args.args[1] = RTAS_ERROR_LOG_MAX; err_args.args[1] = RTAS_ERROR_LOG_MAX;
err_args.args[2] = 0; err_args.args[2] = 0;
temp_args = *rtas_args; save_args = rtas.args;
rtas.args = err_args; rtas.args = err_args;
PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n", PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n",
...@@ -97,19 +97,19 @@ __log_rtas_error(struct rtas_args *rtas_args) ...@@ -97,19 +97,19 @@ __log_rtas_error(struct rtas_args *rtas_args)
PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n"); PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
err_args = rtas.args; err_args = rtas.args;
rtas.args = temp_args; rtas.args = save_args;
return err_args.rets[0]; return err_args.rets[0];
} }
void void
log_rtas_error(struct rtas_args *rtas_args) log_rtas_error(void)
{ {
unsigned long s; unsigned long s;
int rc; int rc;
spin_lock_irqsave(&rtas.lock, s); spin_lock_irqsave(&rtas.lock, s);
rc = __log_rtas_error(rtas_args); rc = __log_rtas_error();
spin_unlock_irqrestore(&rtas.lock, s); spin_unlock_irqrestore(&rtas.lock, s);
if (rc == 0) if (rc == 0)
log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0); log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
...@@ -155,7 +155,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) ...@@ -155,7 +155,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n"); PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
if (rtas_args->rets[0] == -1) if (rtas_args->rets[0] == -1)
logit = (__log_rtas_error(rtas_args) == 0); logit = (__log_rtas_error() == 0);
ifppcdebug(PPCDBG_RTAS) { ifppcdebug(PPCDBG_RTAS) {
for(i=0; i < nret ;i++) for(i=0; i < nret ;i++)
...@@ -447,7 +447,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs) ...@@ -447,7 +447,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
args.rets = (rtas_arg_t *)&(args.args[nargs]); args.rets = (rtas_arg_t *)&(args.args[nargs]);
if (args.rets[0] == -1) if (args.rets[0] == -1)
log_rtas_error(&args); log_rtas_error();
/* Copy out args. */ /* Copy out args. */
if (copy_to_user(uargs->args + nargs, if (copy_to_user(uargs->args + nargs,
......
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