From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb:gadget:f_thor: fix write to filesystem by add dfu_flush()
Date: Thu, 17 Apr 2014 20:11:28 +0200 [thread overview]
Message-ID: <201404172011.29019.marex@denx.de> (raw)
In-Reply-To: <1397755860-20134-1-git-send-email-p.marczak@samsung.com>
On Thursday, April 17, 2014 at 07:31:00 PM, Przemyslaw Marczak wrote:
> Since dfu read/write operations needs to be flushed manually,
> writing to filesystem on MMC by thor was broken. MMC raw write
> actually is working fine because current dfu_flush() function
> writes filesystem only. This commit adds dfu_flush() to f_thor
> and now filesystem write is working.
>
> This change was tested on Trats2 board.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---
> drivers/usb/gadget/f_thor.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index f5c0224..ba47945 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -204,14 +204,14 @@ static long long int download_head(unsigned long long
> total,
>
> static int download_tail(long long int left, int cnt)
> {
> + struct dfu_entity *dfu_entity = dfu_get_entity(alt_setting_num);
> void *transfer_buffer = dfu_get_buf();
> int ret;
>
> debug("%s: left: %llu cnt: %d\n", __func__, left, cnt);
>
> if (left) {
> - ret = dfu_write(dfu_get_entity(alt_setting_num),
> - transfer_buffer, left, cnt++);
> + ret = dfu_write(dfu_entity, transfer_buffer, left, cnt++);
> if (ret) {
> error("DFU write failed [%d]: left: %llu", ret, left);
> return ret;
> @@ -225,11 +225,16 @@ static int download_tail(long long int left, int cnt)
> * This also frees memory malloc'ed by dfu_get_buf(), so no explicit
> * need fo call dfu_free_buf() is needed.
> */
> - ret = dfu_write(dfu_get_entity(alt_setting_num),
> - transfer_buffer, 0, cnt);
> + ret = dfu_write(dfu_entity, transfer_buffer, 0, cnt);
> if (ret)
> error("DFU write failed [%d] cnt: %d", ret, cnt);
Please split this into two patches, one which does cleanup (that's the part
above) and one which fixes the functionality (that's the part below).
> + ret = dfu_flush(dfu_entity, transfer_buffer, 0, cnt);
> + if (ret) {
> + error("DFU flush failed!");
> + return ret;
> + }
> +
> return ret;
> }
Best regards,
Marek Vasut
next prev parent reply other threads:[~2014-04-17 18:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 17:31 [U-Boot] [PATCH] usb:gadget:f_thor: fix write to filesystem by add dfu_flush() Przemyslaw Marczak
2014-04-17 18:11 ` Marek Vasut [this message]
2014-04-18 7:48 ` [U-Boot] [PATCH v2 1/2] usb:gadget:f_thor: code cleanup in function download_tail() Przemyslaw Marczak
2014-04-18 7:48 ` [U-Boot] [PATCH v2 2/2] usb:gadget:f_thor: fix write to filesystem by add dfu_flush() Przemyslaw Marczak
2014-04-21 15:08 ` Marek Vasut
2014-04-21 15:08 ` [U-Boot] [PATCH v2 1/2] usb:gadget:f_thor: code cleanup in function download_tail() Marek Vasut
2014-04-23 9:43 ` [U-Boot] [PATCH v3 " Przemyslaw Marczak
2014-04-23 9:43 ` [U-Boot] [PATCH v3 2/2] usb:gadget:f_thor: fix write to filesystem by add dfu_flush() Przemyslaw Marczak
2014-04-23 12:40 ` Lukasz Majewski
2014-04-23 12:46 ` Marek Vasut
2014-04-28 16:57 ` [U-Boot] [PATCH v4 1/3] usb:gadget:f_thor: code cleanup in function download_tail() Przemyslaw Marczak
2014-04-28 16:57 ` [U-Boot] [PATCH v4 2/3] usb:gadget:f_thor: fix write to filesystem by add dfu_flush() Przemyslaw Marczak
2014-04-28 16:57 ` [U-Boot] [PATCH v4 3/3] drivers:dfu: dfu_flush(): add raw data flush to complete Przemyslaw Marczak
2014-05-06 6:30 ` [U-Boot] [PATCH v4 1/3] usb:gadget:f_thor: code cleanup in function download_tail() Przemyslaw Marczak
2014-05-09 7:21 ` Przemyslaw Marczak
2014-05-09 8:35 ` Lukasz Majewski
2014-05-10 9:41 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201404172011.29019.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox