Commit fed936ed8004dd4972777aa29d882b7e88c6da7b
Committed by
Marek Vasut
1 parent
57ffabe371
Exists in
master
and in
50 other branches
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>
Showing 2 changed files with 13 additions and 0 deletions Side-by-side Diff
drivers/dfu/dfu.c
... | ... | @@ -440,4 +440,16 @@ |
440 | 440 | |
441 | 441 | return NULL; |
442 | 442 | } |
443 | + | |
444 | +int dfu_get_alt(char *name) | |
445 | +{ | |
446 | + struct dfu_entity *dfu; | |
447 | + | |
448 | + list_for_each_entry(dfu, &dfu_list, list) { | |
449 | + if (!strncmp(dfu->name, name, strlen(dfu->name))) | |
450 | + return dfu->alt; | |
451 | + } | |
452 | + | |
453 | + return -ENODEV; | |
454 | +} |
include/dfu.h
... | ... | @@ -126,6 +126,7 @@ |
126 | 126 | struct dfu_entity *dfu_get_entity(int alt); |
127 | 127 | char *dfu_extract_token(char** e, int *n); |
128 | 128 | void dfu_trigger_reset(void); |
129 | +int dfu_get_alt(char *name); | |
129 | 130 | bool dfu_reset(void); |
130 | 131 | int dfu_init_env_entities(char *interface, int dev); |
131 | 132 |