bootstd: Add a function to get bootstd only if available

Provide a function which is safe to call in the 'unbind' path, which
returns the bootstd priv data if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-11-15 16:19:10 -07:00
committed by Tom Rini
parent 9218225773
commit 529f92677d
2 changed files with 28 additions and 0 deletions

View File

@@ -89,6 +89,23 @@ const char *const *const bootstd_get_prefixes(struct udevice *dev);
*/
int bootstd_get_priv(struct bootstd_priv **stdp);
/**
* bootstd_try_priv() - Try to get the (single) state for the bootstd system
*
* The state holds a global list of all bootflows that have been found. This
* function returns the state if available, but takes care not to create the
* device (or uclass) if it doesn't exist.
*
* This function is safe to use in the 'unbind' path. It will always return NULL
* unless the bootstd device is probed and ready, e.g. bootstd_get_priv() has
* previously been called.
*
* TODO(sjg@chromium.org): Consider adding a bootstd pointer to global_data
*
* Return: pointer if the device exists, else NULL
*/
struct bootstd_priv *bootstd_try_priv(void);
/**
* bootstd_clear_glob() - Clear the global list of bootflows
*