return ret;
}
+int sysinfo_get_and_detect(struct udevice **devp)
+{
+ int ret = sysinfo_get(devp);
+
+ if (!ret)
+ ret = sysinfo_detect(*devp);
+
+ return ret;
+}
+
int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
const char **strp)
{
*/
int sysinfo_get(struct udevice **devp);
+/**
+ * sysinfo_get_and_detect() - Get the sysinfo device and detect it.
+ *
+ * @devp: Pointer to structure to receive the sysinfo device.
+ *
+ * This is a convenience wrapper around sysinfo_get() followed by
+ * sysinfo_detect()
+ *
+ * Return: 0 if OK, -ve on error.
+ */
+int sysinfo_get_and_detect(struct udevice **devp);
+
/**
* 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
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)
{
return 0;
}
DM_TEST(dm_test_sysinfo, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
+static int dm_test_sysinfo_get_and_detect(struct unit_test_state *uts)
+{
+ struct udevice *sysinfo;
+ bool called_detect = false;
+
+ ut_assertok(sysinfo_get_and_detect(&sysinfo));
+ ut_assert(sysinfo);
+
+ ut_assertok(sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT,
+ &called_detect));
+ ut_assert(called_detect);
+
+ return 0;
+}
+DM_TEST(dm_test_sysinfo_get_and_detect, UTF_SCAN_PDATA | UTF_SCAN_FDT);