diff options
author | Markus Pargmann <mpa@pengutronix.de> | 2016-02-17 12:28:18 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-02-18 16:10:11 +0100 |
commit | 7290110f1a6f4643beb7695ba7d26e472f8290c6 (patch) | |
tree | bc8c2452d1959fb9ff4557c981eaacdec2622b1a /common | |
parent | 473da9de5b9b5e0266767c1bdf5fc8882fb43a16 (diff) | |
download | barebox-7290110f1a6f4643beb7695ba7d26e472f8290c6.tar.gz barebox-7290110f1a6f4643beb7695ba7d26e472f8290c6.tar.xz |
bbu: Add function to check if an update handler exists
This adds a function to check for the existence of an update handler
based on the supplied bbu_data.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/bbu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/bbu.c b/common/bbu.c index bf3790d13f..a7f6b4b851 100644 --- a/common/bbu.c +++ b/common/bbu.c @@ -111,6 +111,20 @@ static struct bbu_handler *bbu_find_handler_by_device(const char *devicepath) return NULL; } +bool barebox_update_handler_exists(struct bbu_data *data) +{ + struct bbu_handler *handler; + + handler = bbu_find_handler_by_device(data->devicefile); + if (handler) + return true; + + if (!data->handler_name) + return false; + + return !bbu_find_handler(data->handler_name); +} + /* * do a barebox update with data from *data */ |