summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-08-20 17:52:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2008-08-20 17:52:31 +0200
commit17ba93e7a00afdbf9939d1dd2917e7e67f3a44bf (patch)
tree58fea729d0cccde89f2392c86746780af671e2c3
parent66a936fa64a8d1c9aeb08be119c968258fbdc9ce (diff)
downloadbarebox-17ba93e7a00afdbf9939d1dd2917e7e67f3a44bf.tar.gz
barebox-17ba93e7a00afdbf9939d1dd2917e7e67f3a44bf.tar.xz
net: initialize Net* variables unconditionally, not in a big switch/case
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--net/net.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/net/net.c b/net/net.c
index fad1105b9b..45a892d4ab 100644
--- a/net/net.c
+++ b/net/net.c
@@ -296,65 +296,24 @@ restart:
NetState = NETLOOP_CONTINUE;
- /*
- * Start the ball rolling with the given start function. From
- * here on, this code is a state machine driven by received
- * packets and timer events.
- */
-
- switch (protocol) {
-#ifdef CONFIG_NET_NFS
- case NFS:
-#endif
-#ifdef CONFIG_NET_PING
- case PING:
-#endif
-#ifdef CONFIG_NET_SNTP
- case SNTP:
-#endif
- case NETCONS:
- case TFTP:
- NetOurGatewayIP = dev_get_param_ip(eth_current->dev, "gateway");
- NetOurSubnetMask = dev_get_param_ip(eth_current->dev, "netmask");
- NetOurVLAN = getenv_VLAN("vlan");
- NetOurNativeVLAN = getenv_VLAN("nvlan");
-
- switch (protocol) {
-#ifdef CONFIG_NET_NFS
- case NFS:
-#endif
- case NETCONS:
- case TFTP:
- NetServerIP = dev_get_param_ip(eth_current->dev, "serverip");
- break;
-#ifdef CONFIG_NET_PING
- case PING:
- /* nothing */
- break;
-#endif
-#ifdef CONFIG_NET_SNTP
- case SNTP:
- /* nothing */
- break;
-#endif
- default:
- break;
- }
+ NetOurGatewayIP = dev_get_param_ip(eth_current->dev, "gateway");
+ NetOurSubnetMask = dev_get_param_ip(eth_current->dev, "netmask");
+ NetOurVLAN = getenv_VLAN("vlan");
+ NetOurNativeVLAN = getenv_VLAN("nvlan");
+ NetServerIP = dev_get_param_ip(eth_current->dev, "serverip");
- break;
- case BOOTP:
- case RARP:
+ if (protocol == RARP)
/*
* initialize our IP addr to 0 in order to accept ANY
* IP addr assigned to us by the BOOTP / RARP server
*/
NetOurIP = 0;
- NetServerIP = dev_get_param_ip(eth_current->dev, "serverip");
- NetOurVLAN = getenv_VLAN("vlan"); /* VLANs must be read */
- NetOurNativeVLAN = getenv_VLAN("nvlan");
- default:
- break;
- }
+
+ /*
+ * Start the ball rolling with the given start function. From
+ * here on, this code is a state machine driven by received
+ * packets and timer events.
+ */
switch (net_check_prereq (protocol)) {
case 1: