]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/rtas.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / rtas.c
index 1f8505c235482c5fea77a9f3fd1ec175a526a202..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");