drivers:dfu: dfu_flush(): add raw data flush
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Thu, 24 Apr 2014 13:01:13 +0000 (15:01 +0200)
committerPrzemyslaw Marczak <p.marczak@samsung.com>
Fri, 25 Apr 2014 09:28:23 +0000 (11:28 +0200)
Before dfuwrite 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>
drivers/dfu/dfu.c

index 422cdba84d3f2d37414839ca363c4b99d2f0cc43..51d6d71615a464290b97e33c78dcb3b1b7e518eb 100644 (file)
@@ -149,6 +149,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);