drivers:dfu: dfu_flush(): add raw data flush to complete dfu write
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Mon, 12 May 2014 10:05:33 +0000 (12:05 +0200)
committerChanho Park <chanho61.park@samsung.com>
Fri, 24 Jul 2015 07:29:59 +0000 (16:29 +0900)
Before dfu write and flush operations separation,
dfu write data was flushed by host download request
with len of zero size.

Since above change manually calling dfu write with zero
size has non sense (e.g. in THOR). This should be done by
flush operation.
So now dfu_write_buffer_drain() is called in dfu_flush().
If there is any raw data to flush (like it can be in thor)
then it will be physically written to medium.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Marek Vasut <marex@denx.de>
drivers/dfu/dfu.c

index d3798cf9d2003574d2a615bfa90663eb1a9e7bf6..e5d3d9530d54f46134956f593b23f271f6c80499 100644 (file)
@@ -143,6 +143,10 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 {
        int ret = 0;
 
+       ret = dfu_write_buffer_drain(dfu);
+       if (ret)
+               return ret;
+
        if (dfu->flush_medium)
                ret = dfu->flush_medium(dfu);