[POWERPC] Add rtas_service_present() helper
authorNathan Lynch <ntl@pobox.com>
Thu, 7 Dec 2006 00:50:45 +0000 (18:50 -0600)
committerPaul Mackerras <paulus@samba.org>
Fri, 8 Dec 2006 06:10:22 +0000 (17:10 +1100)
To test for the existence of an RTAS function, we typically do:

   foo_token = rtas_token("foo");
   if (foo_token == RTAS_UNKNOWN_SERVICE)
      return;

Add a rtas_service_present method, which provides a more conventional
boolean interface for testing the existence of an RTAS method.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/rtas.c
include/asm-powerpc/rtas.h

index 952f4c2..76b5d7e 100644 (file)
@@ -303,6 +303,12 @@ int rtas_token(const char *service)
 }
 EXPORT_SYMBOL(rtas_token);
 
+int rtas_service_present(const char *service)
+{
+       return rtas_token(service) != RTAS_UNKNOWN_SERVICE;
+}
+EXPORT_SYMBOL(rtas_service_present);
+
 #ifdef CONFIG_RTAS_ERROR_LOGGING
 /*
  * Return the firmware-specified size of the error log buffer
index 031ef57..8eaa7b2 100644 (file)
@@ -159,6 +159,7 @@ extern struct rtas_t rtas;
 
 extern void enter_rtas(unsigned long);
 extern int rtas_token(const char *service);
+extern int rtas_service_present(const char *service);
 extern int rtas_call(int token, int, int, int *, ...);
 extern void rtas_restart(char *cmd);
 extern void rtas_power_off(void);