summaryrefslogtreecommitdiff
path: root/drivers/dfu/dfu.c
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2013-10-08 14:30:38 +0200
committerMarek Vasut <marex@denx.de>2013-10-20 23:42:40 +0200
commitfed936ed8004dd4972777aa29d882b7e88c6da7b (patch)
treecd8440891d35fa5999bbc47e0b43ed809f53deae /drivers/dfu/dfu.c
parent57ffabe37114fe67f5ffac5805b343e4e1979b57 (diff)
downloadu-boot-imx-fed936ed8004dd4972777aa29d882b7e88c6da7b.zip
u-boot-imx-fed936ed8004dd4972777aa29d882b7e88c6da7b.tar.gz
u-boot-imx-fed936ed8004dd4972777aa29d882b7e88c6da7b.tar.bz2
dfu:core: Find DFU alt setting number by passing its name
New function - dfu_get_alt() - has been added to dfu core. If present, it returns alt setting's number corresponding to passed name. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'drivers/dfu/dfu.c')
-rw-r--r--drivers/dfu/dfu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index f328735..4ec330c 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -440,3 +440,15 @@ struct dfu_entity *dfu_get_entity(int alt)
return NULL;
}
+
+int dfu_get_alt(char *name)
+{
+ struct dfu_entity *dfu;
+
+ list_for_each_entry(dfu, &dfu_list, list) {
+ if (!strncmp(dfu->name, name, strlen(dfu->name)))
+ return dfu->alt;
+ }
+
+ return -ENODEV;
+}