From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Thu, 10 Apr 2014 09:54:30 +0200 Subject: [U-Boot] [PATCH 2/2] dfu, nand: add medium specific polltimeout function In-Reply-To: <1397106486-1233-2-git-send-email-hs@denx.de> References: <1397106486-1233-1-git-send-email-hs@denx.de> <1397106486-1233-2-git-send-email-hs@denx.de> Message-ID: <201404100954.30588.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday, April 10, 2014 at 07:08:06 AM, Heiko Schocher wrote: > add a possibility to add a medium specific polltimeout > function. So it is possible to define different > poll timeouts. > > Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT > only on nand ubi partitions, which is currently the only > usecase. > > Signed-off-by: Heiko Schocher > Cc: Lukasz Majewski > Cc: Kyungmin Park > Cc: Marek Vasut > Cc: Pantelis Antoniou [...] > @@ -174,6 +174,17 @@ static void dnload_request_flush(struct usb_ep *ep, > struct usb_request *req) req->length, f_dfu->blk_seq_num); > } > > +static void dfu_set_poll_timeout_manifest(struct dfu_status *dstat, > + struct f_dfu *f_dfu) > +{ > + struct dfu_entity *dfu = dfu_get_entity(f_dfu->altsetting); > + > + if (dfu->poll_timeout) > + dfu_set_poll_timeout(dstat, dfu->poll_timeout(dfu)); > + else > + dfu_set_poll_timeout(dstat, DFU_MANIFEST_POLL_TIMEOUT); > +} Don't you think it'd be better (yet more intrusive) to have all the DFU users have default implementation of dfu->poll_timeout() ? Then you'd be able to avoid this if and even get rid of this dfu_set_poll_timeout_manifest() function. [...] Best regards, Marek Vasut