From: Mike Frysinger Date: Tue, 3 Apr 2012 16:41:28 -0400 Subject: [U-Boot] [PATCH 1/3] net/eth: set status to active before calling init In-Reply-To: <1332533480-19121-1-git-send-email-bigeasy@linutronix.de> References: <1332533480-19121-1-git-send-email-bigeasy@linutronix.de> Message-ID: <201204031641.30268.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 23 March 2012 16:11:17 Sebastian Andrzej Siewior wrote: > If we set the status after successful init call then we get in trouble > if stdout (or setderr) is set to netconsole. If we are going to use one > of those (lets say printf) during ->init() the following happens: > - network is of (state passive) > - we switch on netconsole > - nc_getc() gets called > - in NetLoop() we switch on ethernet via eth_init() > - we end up in tsec_init() (inc case we use the tsec driver). Here we > call a printf() considering your followup patches convert printf() to serial_printf(), is this patch still needed ? > --- a/net/eth.c > +++ b/net/eth.c > @@ -380,14 +380,17 @@ int eth_init(bd_t *bis) > > old_current = eth_current; > do { > + int old_state; > + > debug("Trying %s\n", eth_current->name); > > - if (eth_current->init(eth_current,bis) >= 0) { > - eth_current->state = ETH_STATE_ACTIVE; > - > + old_state = eth_current->state; > + eth_current->state = ETH_STATE_ACTIVE; > + if (eth_current->init(eth_current,bis) >= 0) > return 0; > - } > + > debug("FAIL\n"); > + eth_current->state = old_state; > > eth_try_another(0); > } while (old_current != eth_current); this needs a comment in the code explaining why you're setting things active early and then turning it off -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: