All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] netloop: updates for NetLoop
Date: Thu, 26 Feb 2009 08:16:52 +0100	[thread overview]
Message-ID: <49A641E4.8000001@denx.de> (raw)
In-Reply-To: <200902251201.45611.vapier@gentoo.org>

[PATCH v2] netloop: updates for NetLoop

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 <hs@denx.de>
---
changes since v1:
- added comments from Mike Frysinger

 common/cmd_nvedit.c |    7 +++++++
 net/eth.c           |    5 ++---
 net/net.c           |    8 +++-----
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 95eebb5..30e296c 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -75,6 +75,13 @@ DECLARE_GLOBAL_DATA_PTR;
 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 4bbf84b..a494912 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 a89f6a0..0887f6e 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,15 +276,16 @@ 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 ();

 	/* update only when the environment has changed */
 	if (env_changed_id == env_id)
-		return 0;
+		return;

 	switch (protocol) {
 #if defined(CONFIG_CMD_NFS)
@@ -347,7 +346,6 @@ NetInitLoop(proto_t protocol)
 		break;
 	}
 	env_changed_id = env_id;
-	return 0;
 }

 /**********************************************************************/
-- 
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2009-02-26  7:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 12:40 [U-Boot] [PATCH] netloop: updates for NetLoop Heiko Schocher
2009-02-25 17:01 ` Mike Frysinger
2009-02-26  7:16   ` Heiko Schocher [this message]
2009-02-26  8:47     ` [U-Boot] [PATCH v2] " Mike Frysinger
2009-04-03 21:57     ` Wolfgang Denk
2009-04-03 23:28       ` Michael Zaidman
2009-04-24 19:45       ` Wolfgang Denk
2009-04-24 23:41         ` Ben Warren
2009-04-27 22:09     ` Wolfgang Denk
2009-04-28  5:41       ` [U-Boot] [PATCH] [PATCH v3] " Heiko Schocher
2009-04-28  7:09         ` Ben Warren
2009-04-28  6:21           ` Heiko Schocher
2009-04-28  6:36           ` [U-Boot] [PATCH v4] " Heiko Schocher
2009-04-28 17:22             ` Ben Warren
2009-05-15 19:18               ` Wolfgang Denk
2009-05-15 19:18             ` Wolfgang Denk

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=49A641E4.8000001@denx.de \
    --to=hs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.