Re: [PATCH 3/3] net/eth: fix link handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 26, 2012 at 01:53:31PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> The current code handle just the send where we are supposed to the same on rx
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>
> ---

This is broken. For better readability I refer to the result, not to the
patch:

> int eth_open(void)
> {
> 	int ret;
> 
> 	if (!eth_current)
> 		return -ENODEV;
> 
> 	if (!eth_current->active) {
> 		ret = eth_current->open(eth_current);
> 		if (ret)
> 			return ret;
> 
> 		if (eth_current->phydev)
> 			eth_current->active = eth_current->phydev->link;
> 		else
> 			eth_current->active = 1;
> 	}
> 
> 	if (!eth_current->active)
> 		return -ENETDOWN;
> 
> 	return 0;
> }

The eth->active is for tracking whether a device is opened (thus we have
to call eth->halt). With this patch eth->active == 0 could mean:

a) device not opened
b) opened, but no link

This is asking for trouble. A bit only has two states, you should not
encode three states in it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux