All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] net/eth: set status to active before calling init
Date: Tue, 03 Apr 2012 22:51:10 +0200	[thread overview]
Message-ID: <4F7B62BE.4040409@linutronix.de> (raw)
In-Reply-To: <201204031641.30268.vapier@gentoo.org>

On 04/03/2012 10:41 PM, Mike Frysinger wrote:
> 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 ?

Not for the tsec driver but it is possible that other driver do have
the same problem. I haven't also checked all the phy devices which
might do some prints. Therefore I would prefer to have this in.

>> --- 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

Okay.

> -mike

Sebastian

      reply	other threads:[~2012-04-03 20:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-23 20:11 [U-Boot] [PATCH 1/3] net/eth: set status to active before calling init Sebastian Andrzej Siewior
2012-03-23 20:11 ` [U-Boot] [PATCH 2/3] net/tsec: convert the printf() to serial_printf() Sebastian Andrzej Siewior
2012-03-23 20:11 ` [U-Boot] [PATCH 3/3] net/tsec: Don't tell the link status if used with netconsole Sebastian Andrzej Siewior
2012-04-03 20:42   ` Mike Frysinger
2012-04-03 20:54     ` Sebastian Andrzej Siewior
2012-04-04 15:27       ` Joe Hershberger
2012-04-08  8:26         ` Mike Frysinger
2012-04-09 21:43           ` Joe Hershberger
2012-04-03 20:41 ` [U-Boot] [PATCH 1/3] net/eth: set status to active before calling init Mike Frysinger
2012-04-03 20:51   ` Sebastian Andrzej Siewior [this message]

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=4F7B62BE.4040409@linutronix.de \
    --to=bigeasy@linutronix.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.