]> git.sur5r.net Git - u-boot/commitdiff
dfu: add free_entity() to struct dfu_entity
authorStephen Warren <swarren@nvidia.com>
Wed, 11 Jun 2014 22:03:35 +0000 (16:03 -0600)
committerTom Rini <trini@ti.com>
Sat, 9 Aug 2014 15:16:59 +0000 (11:16 -0400)
This allows the backend to free any resources allocated during the
relevant dfu_fill_entity_*() call. This will soon be used by the
SF backend.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
drivers/dfu/dfu.c
include/dfu.h

index b8d382d9b5dfefd453557ff122c2a3399b31d318..897dfab77be6537e509972894df6d8bd154e835a 100644 (file)
@@ -401,6 +401,7 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt,
 
        dfu->alt = alt;
        dfu->max_buf_size = 0;
+       dfu->free_entity = NULL;
 
        /* Specific for mmc device */
        if (strcmp(interface, "mmc") == 0) {
@@ -427,6 +428,8 @@ void dfu_free_entities(void)
 
        list_for_each_entry_safe_reverse(dfu, p, &dfu_list, list) {
                list_del(&dfu->list);
+               if (dfu->free_entity)
+                       dfu->free_entity(dfu);
                t = dfu;
        }
        if (t)
index d5562dcb37d1a28dcfe78251123ed76cb4b0b6df..43814b38ec6dfbd6c6441481fcacd9d8b6ab2d47 100644 (file)
@@ -110,6 +110,8 @@ struct dfu_entity {
        int (*flush_medium)(struct dfu_entity *dfu);
        unsigned int (*poll_timeout)(struct dfu_entity *dfu);
 
+       void (*free_entity)(struct dfu_entity *dfu);
+
        struct list_head list;
 
        /* on the fly state */