diff options
| author | Simon Glass <[email protected]> | 2024-11-15 16:19:10 -0700 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-01-15 08:48:42 -0600 |
| commit | 529f92677defa4788ef0d43229caa5771be041a0 (patch) | |
| tree | ad70e5e257d278cdf78e72469f42bbcfdf4de7e5 /boot/bootstd-uclass.c | |
| parent | 92182257733b446f3074a8a9b0a7eafea6ea8c1c (diff) | |
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 <[email protected]>
Diffstat (limited to 'boot/bootstd-uclass.c')
| -rw-r--r-- | boot/bootstd-uclass.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c index 596d3e5e41d..b2f80808c85 100644 --- a/boot/bootstd-uclass.c +++ b/boot/bootstd-uclass.c @@ -140,6 +140,17 @@ const char *const *const bootstd_get_prefixes(struct udevice *dev) return std->prefixes ? std->prefixes : default_prefixes; } +struct bootstd_priv *bootstd_try_priv(void) +{ + struct udevice *dev; + + dev = uclass_try_first_device(UCLASS_BOOTSTD); + if (!dev || !device_active(dev)) + return NULL; + + return dev_get_priv(dev); +} + int bootstd_get_priv(struct bootstd_priv **stdp) { struct udevice *dev; |
