From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Tue, 28 Apr 2009 10:22:29 -0700 Subject: [U-Boot] [PATCH v4] netloop: updates for NetLoop In-Reply-To: <49F6A3DB.2020907@denx.de> References: <49A53C4D.5060907@denx.de> <200902251201.45611.vapier@gentoo.org> <49A641E4.8000001@denx.de> <20090427220949.AE2EA83420E8@gemini.denx.de> <49F696EF.8060903@denx.de> <49F6ABA5.1040901@gmail.com> <49F6A3DB.2020907@denx.de> Message-ID: <49F73B55.50603@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang, Heiko Schocher wrote: > Fix some issues introduced from commit: > 2f70c49e5b9813635ad73666aa30f304c7fdeda9 > suggested by Mike Frysinger. > > - added some comment for the env_id variable in common_cmd_nvedit.c > - moved some variables in fn scope instead of file scope > - NetInitLoop now static void > > Signed-off-by: Heiko Schocher > Acked-by: Ben Warren > --- > changes since v1: > - added comments from Mike Frysinger > > changes since v2: > - rebased against current head, commit > 28afe0160f87ff74574150d703055a965f91422a > > changes since v3: > - corrected my EMail address, as Ben Warren suggested. > > common/cmd_nvedit.c | 7 +++++++ > net/eth.c | 5 ++--- > net/net.c | 7 +++---- > 3 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c > index 163765a..3ee971a 100644 > --- a/common/cmd_nvedit.c > +++ b/common/cmd_nvedit.c > @@ -77,6 +77,13 @@ SPI_FLASH|MG_DISK|NVRAM|NOWHERE} > static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; > #define N_BAUDRATES (sizeof(baudrate_table) / sizeof(baudrate_table[0])) > > +/* > + * This variable is incremented on each do_setenv (), so it can > + * be used via get_env_id() as an indication, if the environment > + * has changed or not. So it is possible to reread an environment > + * variable only if the environment was changed ... done so for > + * example in NetInitLoop() > + */ > static int env_id = 1; > > int get_env_id (void) > diff --git a/net/eth.c b/net/eth.c > index c6fa5b9..8940ebf 100644 > --- a/net/eth.c > +++ b/net/eth.c > @@ -57,9 +57,6 @@ int eth_setenv_enetaddr(char *name, const uchar *enetaddr) > > #if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) > > -static char *act = NULL; > -static int env_changed_id = 0; > - > /* > * CPU and board-specific Ethernet initializations. Aliased function > * signals caller to move on > @@ -471,6 +468,8 @@ void eth_try_another(int first_restart) > #ifdef CONFIG_NET_MULTI > void eth_set_current(void) > { > + static char *act = NULL; > + static int env_changed_id = 0; > struct eth_device* old_current; > int env_id; > > diff --git a/net/net.c b/net/net.c > index b8648bd..5637cf5 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -209,8 +209,6 @@ uchar NetArpWaitPacketBuf[PKTSIZE_ALIGN + PKTALIGN]; > ulong NetArpWaitTimerStart; > int NetArpWaitTry; > > -int env_changed_id = 0; > - > void ArpRequest (void) > { > int i; > @@ -278,9 +276,10 @@ void ArpTimeoutCheck(void) > } > } > > -int > +static void > NetInitLoop(proto_t protocol) > { > + static int env_changed_id = 0; > bd_t *bd = gd->bd; > int env_id = get_env_id (); > > @@ -295,7 +294,7 @@ NetInitLoop(proto_t protocol) > env_changed_id = env_id; > } > > - return 0; > + return; > } > > /**********************************************************************/ > Please apply directly. regards, Ben