From: Nora Schiffer <[email protected]> sysinfo_detect() is commonly called after sysinfo_get(). Make the API a bit more convenient to use by introducing a helper.
Signed-off-by: Nora Schiffer <[email protected]> Signed-off-by: Alexander Feilke <[email protected]> --- include/sysinfo.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/sysinfo.h b/include/sysinfo.h index 54eb64a204a..7fcc3e273be 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -373,6 +373,26 @@ int sysinfo_get_data_by_index(struct udevice *dev, int id, int index, */ int sysinfo_get(struct udevice **devp); +/** + * sysinfo_get_and_detect() - Get the sysinfo device and run its detect + * operation. + * @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. + */ +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 +458,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

