]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/rtas.c
Merge branches 'topic/fixes', 'topic/cleanups' and 'topic/documentation' into for...
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / rtas.c
index c680f1bbd3877931d88b776940a08156cc6523ce..fdfe14c4bdefc735640745625cb559fc4908a2fa 100644 (file)
@@ -566,6 +566,32 @@ int rtas_get_sensor(int sensor, int index, int *state)
 }
 EXPORT_SYMBOL(rtas_get_sensor);
 
+bool rtas_indicator_present(int token, int *maxindex)
+{
+       int proplen, count, i;
+       const struct indicator_elem {
+               u32 token;
+               u32 maxindex;
+       } *indicators;
+
+       indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen);
+       if (!indicators)
+               return false;
+
+       count = proplen / sizeof(struct indicator_elem);
+
+       for (i = 0; i < count; i++) {
+               if (indicators[i].token != token)
+                       continue;
+               if (maxindex)
+                       *maxindex = indicators[i].maxindex;
+               return true;
+       }
+
+       return false;
+}
+EXPORT_SYMBOL(rtas_indicator_present);
+
 int rtas_set_indicator(int indicator, int index, int new_value)
 {
        int token = rtas_token("set-indicator");
@@ -792,6 +818,9 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
        if (args.token == RTAS_UNKNOWN_SERVICE)
                return -EINVAL;
 
+       args.rets = &args.args[nargs];
+       memset(args.rets, 0, args.nret * sizeof(rtas_arg_t));
+
        /* Need to handle ibm,suspend_me call specially */
        if (args.token == ibm_suspend_me_token) {
                rc = rtas_ibm_suspend_me(&args);
@@ -808,8 +837,6 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
        enter_rtas(__pa(&rtas.args));
        args = rtas.args;
 
-       args.rets = &args.args[nargs];
-
        /* A -1 return code indicates that the last command couldn't
           be completed due to a hardware error. */
        if (args.rets[0] == -1)