All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Schmidt <will_schmidt@vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Paul Mackerras <paulus@samba.org>
Subject: [PATCH] [POWERPC] fix up log_plpar_hcall_return
Date: Tue, 06 Mar 2007 17:11:41 -0600	[thread overview]
Message-ID: <1173222701.13165.9.camel@localhost> (raw)


This is mostly cosmetic.  This updates log_plpar_hcall_return() to use a
case statement rather than an if-then-else jumble, and moves it to
rtas.c where it can be near the other rtas related functions. 

Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
---
 arch/powerpc/kernel/lparcfg.c |   25 -------------------------
 arch/powerpc/kernel/rtas.c    |   29 +++++++++++++++++++++++++++++
 include/asm-powerpc/rtas.h    |    1 +
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 89486b6..e89471f 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -130,31 +130,6 @@ #ifdef CONFIG_PPC_PSERIES
 /*
  * Methods used to fetch LPAR data when running on a pSeries platform.
  */
-/* find a better place for this function... */
-static void log_plpar_hcall_return(unsigned long rc, char *tag)
-{
-	if (rc == 0)		/* success, return */
-		return;
-/* check for null tag ? */
-	if (rc == H_HARDWARE)
-		printk(KERN_INFO
-		       "plpar-hcall (%s) failed with hardware fault\n", tag);
-	else if (rc == H_FUNCTION)
-		printk(KERN_INFO
-		       "plpar-hcall (%s) failed; function not allowed\n", tag);
-	else if (rc == H_AUTHORITY)
-		printk(KERN_INFO
-		       "plpar-hcall (%s) failed; not authorized to this"
-		       " function\n", tag);
-	else if (rc == H_PARAMETER)
-		printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",
-		       tag);
-	else
-		printk(KERN_INFO
-		       "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",
-		       tag, rc);
-
-}
 
 /*
  * H_GET_PPP hcall returns info in 4 parms.
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9d0735a..b215b6b 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -506,6 +506,35 @@ int rtas_error_rc(int rtas_rc)
 	return rc;
 }
 
+/* provide a human-readible description of some hcall return codes. */
+void log_plpar_hcall_return(unsigned long rc, char *tag)
+{
+	switch(rc) {
+	case 0:
+		return;
+	case H_HARDWARE:
+		printk(KERN_INFO "plpar-hcall (%s) "
+					"Hardware fault\n", tag);
+		return;
+	case H_FUNCTION:
+		printk(KERN_INFO "plpar-hcall (%s) "
+					"Function not allowed\n", tag);
+		return;
+	case H_AUTHORITY:
+		printk(KERN_INFO "plpar-hcall (%s) "
+				"Not authorized to this function\n", tag);
+		return;
+	case H_PARAMETER:
+		printk(KERN_INFO "plpar-hcall (%s) "
+					"Bad parameter(s)\n",tag);
+		return;
+	default:
+		printk(KERN_INFO "plpar-hcall (%s) "
+					"Unexpected rc(0x%lx)\n", tag, rc);
+	}
+}
+EXPORT_SYMBOL(log_plpar_hcall_return);
+
 int rtas_get_power_level(int powerdomain, int *level)
 {
 	int token = rtas_token("get-power-level");
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 8eaa7b2..f36aaba 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -185,6 +185,7 @@ extern int early_init_dt_scan_rtas(unsig
 		const char *uname, int depth, void *data);
 
 extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
+extern void log_plpar_hcall_return(unsigned long rc, char *tag);
 
 /* Error types logged.  */
 #define ERR_FLAG_ALREADY_LOGGED	0x0

             reply	other threads:[~2007-03-06 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06 23:11 Will Schmidt [this message]
2007-03-07  0:12 ` [PATCH] [POWERPC] fix up log_plpar_hcall_return Stephen Rothwell
2007-03-07 15:29   ` Will Schmidt
2007-03-07 14:36 ` Benjamin Herrenschmidt
2007-03-07 15:26   ` Will Schmidt

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=1173222701.13165.9.camel@localhost \
    --to=will_schmidt@vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.