From: Tom Rini Date: Wed, 20 Mar 2013 15:40:25 -0400 Subject: [U-Boot] [PATCH v3 03/16] net: Add prototype for update_tftp, and use autoconf In-Reply-To: <1361895069-7343-4-git-send-email-sjg@chromium.org> References: <1361895069-7343-1-git-send-email-sjg@chromium.org> <1361895069-7343-4-git-send-email-sjg@chromium.org> Message-ID: <20130320194025.GQ25919@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Feb 26, 2013 at 08:10:56AM -0800, Simon Glass wrote: > This function should be declared in net.h. At the same time, let's use > autoconf instead of #ifdef for its inclusion. > > Signed-off-by: Simon Glass > Acked-by: Joe Hershberger [snip] > @@ -266,12 +254,16 @@ int update_tftp(ulong addr) > /* get load address of downloaded update file */ > if ((env_addr = getenv("loadaddr")) != NULL) > addr = simple_strtoul(env_addr, NULL, 16); > + else if (autoconf_has_update_load_addr()) > + addr = autoconf_update_load_addr(); > else > - addr = CONFIG_UPDATE_LOAD_ADDR; > + addr = 0x100000; > > + msec_max = autoconf_has_update_tftp_msec_max() ? > + autoconf_update_tftp_msec_max() : 100; > > - if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX, > - CONFIG_UPDATE_TFTP_CNT_MAX, addr)) { > + if (update_load(filename, msec_max, autoconf_update_tftp_cnt_max(), > + addr)) { This doesn't read nearly as clean to me as the old code. Part of the problem is that we really need a way to foce an CONFIG option to be set to something and give a default (so, the Kconfig switch-over). Now, in cases like this it the compiler smart enough to say "oh, msec_max is a constant, lets not waste the space on a variable" ? Would const'ing that help or confuse things would be a follow up question. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: