diff mbox

[U-Boot,3/4] dfu: add free_entity() to struct dfu_entity

Message ID 1402524216-9999-3-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Marek Vasut
Headers show

Commit Message

Stephen Warren June 11, 2014, 10:03 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

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 | 3 +++
 include/dfu.h     | 2 ++
 2 files changed, 5 insertions(+)

Comments

Ɓukasz Majewski June 20, 2014, 7:55 a.m. UTC | #1
Hi Stephen,

> From: Stephen Warren <swarren@nvidia.com>
> 
> 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>
> ---

Applied to u-boot-dfu

Thanks for the patch.
diff mbox

Patch

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index b8d382d9b5df..897dfab77be6 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -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)
diff --git a/include/dfu.h b/include/dfu.h
index d5562dcb37d1..43814b38ec6d 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -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 */