To make it easier to consume the devinfo output without directly
printing it to the console, switch over the handler to use structured
I/O.

Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org>
---
 drivers/tee/tee_core.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index a4bb9af46933..151f8eb70e00 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -10,6 +10,7 @@
 #include <linux/tee_drv.h>
 #include <linux/uaccess.h>
 #include <linux/printk.h>
+#include <structio.h>
 #include "tee_private.h"
 
 #define TEE_NUM_DEVICES        32
@@ -500,14 +501,18 @@ static void tee_devinfo(struct device *dev)
                break;
        }
 
-       printf("Implementation ID: %d%s%s%s\n", vers.impl_id,
-              impl ? " ( " : "", impl, impl ? ")" : "");
-       if (!dev->parent)
-               return;
+       if (structio_active()) {
+               stprintf("impl.id", "%d", vers.impl_id);
+               if (impl)
+                       stprintf("impl.name", "%s", impl);
+       } else {
+               printf("Implementation ID: %d%s%s%s\n", vers.impl_id,
+                      impl ? " ( " : "", impl, impl ? ")" : "");
+       }
 
        rev = dev_get_param(dev->parent, "revision");
        if (rev)
-               printf("Revision: %s\n", rev);
+               stprintf_prefix("impl.rev", "Revision: ", "%s", rev);
 }
 
 /**
-- 
2.39.5


Reply via email to