summaryrefslogtreecommitdiff
path: root/common/image.c
diff options
context:
space:
mode:
authorNaoki Hayama <naoki.hayama@lineo.co.jp>2020-10-07 11:21:25 +0900
committerTom Rini <trini@konsulko.com>2020-10-22 09:54:52 -0400
commit02d41b01bd78dc863614c2919375f366abdeff40 (patch)
tree3762ba0471fa6774acac9a25f8e23bbd28638290 /common/image.c
parent2dfdd0c4de48d261a72905a61704d4919587e45b (diff)
image: Add a function to modify category information
Add a generic function which can check whether a category has an entry ID. Signed-off-by: Naoki Hayama <naoki.hayama@lineo.co.jp> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/image.c')
-rw-r--r--common/image.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c
index 645bfef169..4fc4a0f1c4 100644
--- a/common/image.c
+++ b/common/image.c
@@ -859,6 +859,24 @@ const char *genimg_get_cat_desc(enum ih_category category)
}
/**
+ * genimg_cat_has_id - check whether category has entry id
+ * @category: category to look up (enum ih_category)
+ * @id: entry id to be checked
+ *
+ * This will scan the translation table trying to find the entry that matches
+ * the given id.
+ *
+ * @return true if category has entry id; false if not
+ */
+bool genimg_cat_has_id(enum ih_category category, uint id)
+{
+ if (get_table_entry(table_info[category].table, id))
+ return true;
+
+ return false;
+}
+
+/**
* get_table_entry_name - translate entry id to long name
* @table: pointer to a translation table for entries of a specific type
* @msg: message to be returned when translation fails