public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] usb, dfu: extract flush code into seperate function
Date: Thu, 13 Mar 2014 13:38:13 +0100	[thread overview]
Message-ID: <201403131338.13731.marex@denx.de> (raw)
In-Reply-To: <53214297.2060605@denx.de>

On Thursday, March 13, 2014 at 06:31:03 AM, Heiko Schocher wrote:
> Hello Marek,
> 
> Am 12.03.2014 12:43, schrieb Marek Vasut:
> > On Wednesday, March 12, 2014 at 11:01:19 AM, Heiko Schocher wrote:
> >> move the flushing code into an extra function dfu_flush(),
> >> so it can be used from other code.
> >> 
> >> Signed-off-by: Heiko Schocher<hs@denx.de>
> >> Cc: Lukasz Majewski<l.majewski@samsung.com>
> >> Cc: Kyungmin Park<kyungmin.park@samsung.com>
> >> Cc: Marek Vasut<marex@denx.de>
> >> ---
> >> 
> >>   drivers/dfu/dfu.c | 46 ++++++++++++++++++++++++++--------------------
> >>   include/dfu.h     |  1 +
> >>   2 files changed, 27 insertions(+), 20 deletions(-)
> >> 
> >> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> >> index 56e69fd..193e047 100644
> >> --- a/drivers/dfu/dfu.c
> >> +++ b/drivers/dfu/dfu.c
> >> @@ -127,6 +127,31 @@ static int dfu_write_buffer_drain(struct dfu_entity
> >> *dfu) return ret;
> >> 
> >>   }
> >> 
> >> +int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int
> >> blk_seq_num) +{
> >> +	int ret = 0;
> >> +
> >> +	/* end? */
> > 
> > What does this comment mean ? I don't understand it ...
> 
> Comes from original code... Thinking about it, it seems better to
> let this comment and the below "if" in the dfu_write function...
> 
> >> +	if (size == 0) {
> > 
> > You can check this like so:
> > 
> > if (size)
> > 
> >    return;
> 
> ... as when moving this "if" back to dfu_write(), this "if" kindly
> disappears in the patch 2/3 of this series, as calling dfu_flush()
> is only in the new dfuMANIFEST state necessary, which is called at
> the end of the dfu transfer, so no need for checking, if end of
> size is reached!

OK, this makes sense. Thanks for pointing this out.

  reply	other threads:[~2014-03-13 12:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 10:01 [U-Boot] [PATCH 0/3] usb: dfu: introduce dfuMANIFEST state Heiko Schocher
2014-03-12 10:01 ` [U-Boot] [PATCH 1/3] usb, dfu: extract flush code into seperate function Heiko Schocher
2014-03-12 11:43   ` Marek Vasut
2014-03-13  5:31     ` Heiko Schocher
2014-03-13 12:38       ` Marek Vasut [this message]
2014-03-14 10:36       ` Lukasz Majewski
2014-03-12 10:01 ` [U-Boot] [PATCH 2/3] usb: dfu: introduce dfuMANIFEST state Heiko Schocher
2014-03-14 10:47   ` Lukasz Majewski
2014-03-17  6:34     ` Heiko Schocher
2014-03-17  9:46       ` Lukasz Majewski
2014-03-17 10:11         ` Heiko Schocher
2014-03-17 10:42           ` Lukasz Majewski
2014-03-12 10:01 ` [U-Boot] [PATCH 3/3] am335x, dfu: add DFU_MANIFEST_POLL_TIMEOUT to the siemens boards Heiko Schocher
2014-03-14 10:48   ` Lukasz Majewski

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=201403131338.13731.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