[PATCH 2/6] sysinfo: add sysinfo_get_and_detect() helper

Feilke, Alexander alexander.feilke at ew.tq-group.com
Fri May 8 11:43:10 CEST 2026


Signed-off-by: Nora Schiffer <nora.schiffer at ew.tq-group.com>
Signed-off-by: Alexander Feilke <alexander.feilke at ew.tq-group.com>
---
 include/sysinfo.h | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
I missed a silly mistake in this patch. This should be the correct version.
Old CI pipeline run: https://dev.azure.com/u-boot/u-boot/_build/results?buildId=13173
New CI pipeline run: https://dev.azure.com/u-boot/u-boot/_build/results?buildId=13175
diff --git a/include/sysinfo.h b/include/sysinfo.h
index 54eb64a204a..976144fd4fc 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -373,6 +373,27 @@ int sysinfo_get_data_by_index(struct udevice *dev, int id, int index,
  */
 int sysinfo_get(struct udevice **devp);
 
+/**
+ * sysinfo_get_and_detect() - Return the sysinfo device for the sysinfo in
+ * question and runs its detect operation.
+ * @devp: Pointer to structure to receive the sysinfo device.
+ *
+ * Since there can only be at most one sysinfo instance, the API can supply a
+ * function that returns the unique device. This is especially useful for use
+ * in sysinfo files.
+ *
+ * Return: 0 if OK, -ve on error.
+ */
+static inline int sysinfo_get_and_detect(struct udevice **devp)
+{
+ int ret = sysinfo_get(devp);
+
+ if (!ret)
+   ret = sysinfo_detect(*devp);
+
+ return ret;
+}
+
 /**
  * sysinfo_get_fit_loadable - Get the name of an image to load from FIT
  * This function can be used to provide the image names based on runtime
@@ -438,6 +459,11 @@ static inline int sysinfo_get(struct udevice **devp)
  return -ENOSYS;
 }
 
+static inline int sysinfo_get_and_detect(struct udevice **devp)
+{
+ return -ENOSYS;
+}
+
 static inline int sysinfo_get_fit_loadable(struct udevice *dev, int index,
             const char *type, const char **strp)
 {
-- 
2.34.1


More information about the U-Boot mailing list