Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Add rtas_service_present() helper

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>

authored by

Nathan Lynch and committed by
Paul Mackerras
f2d6d2d8 9d9d868e

+7
+6
arch/powerpc/kernel/rtas.c
··· 303 303 } 304 304 EXPORT_SYMBOL(rtas_token); 305 305 306 + int rtas_service_present(const char *service) 307 + { 308 + return rtas_token(service) != RTAS_UNKNOWN_SERVICE; 309 + } 310 + EXPORT_SYMBOL(rtas_service_present); 311 + 306 312 #ifdef CONFIG_RTAS_ERROR_LOGGING 307 313 /* 308 314 * Return the firmware-specified size of the error log buffer
+1
include/asm-powerpc/rtas.h
··· 159 159 160 160 extern void enter_rtas(unsigned long); 161 161 extern int rtas_token(const char *service); 162 + extern int rtas_service_present(const char *service); 162 163 extern int rtas_call(int token, int, int, int *, ...); 163 164 extern void rtas_restart(char *cmd); 164 165 extern void rtas_power_off(void);