ucm: fill missing device entries (conflicting / supported)

It is not necessary to maintain this information in sync in the configuration
files. Fill the missing entries to the complementary devices.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-02-07 16:18:11 +01:00
parent 251bc204a1
commit fdf96312fa
3 changed files with 75 additions and 1 deletions

View file

@ -328,6 +328,31 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list)
}
}
int uc_mgr_put_to_dev_list(struct dev_list *dev_list, const char *name)
{
struct list_head *pos;
struct dev_list_node *dlist;
char *n;
list_for_each(pos, &dev_list->list) {
dlist = list_entry(pos, struct dev_list_node, list);
if (strcmp(dlist->name, name) == 0)
return 0;
}
dlist = calloc(1, sizeof(*dlist));
if (dlist == NULL)
return -ENOMEM;
n = strdup(name);
if (n == NULL) {
free(dlist);
return -ENOMEM;
}
dlist->name = n;
list_add(&dlist->list, &dev_list->list);
return 0;
}
int uc_mgr_rename_in_dev_list(struct dev_list *dev_list, const char *src,
const char *dst)
{