]> git.ipfire.org Git - people/ms/u-boot.git/commit
net: expose eth_is_active() function to test network device state
authorBernhard Nortmann <bernhard.nortmann@web.de>
Mon, 14 Sep 2015 13:29:43 +0000 (15:29 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 30 Sep 2015 02:54:45 +0000 (21:54 -0500)
commiteaa8a195cc2372349276bf7d581a9e1e2cc83511
tree8944c5ec6ac73f2e36c7841a7eb4715fb7a96a28
parent26d3acdab86a4ade8e9407822d8cdbe51b1f7412
net: expose eth_is_active() function to test network device state

The previous eth_device struct returned by eth_get_dev() allowed
code to directly query the state member field. However, with
CONFIG_DM_ETH this data gets encapsulated (i.e. private), and
eth_get_dev() returns a udevice struct 'abstraction' instead.

This breaks legacy code relying on the former behaviour - e.g.
netconsole.
(see http://lists.denx.de/pipermail/u-boot/2015-June/216528.html)

The patch introduces a method to retrieve the ethernet device
state in a 'clean' and uniform way, supporting both legacy code
and driver model. The new function eth_is_active() accepts a
device struct pointer and tests it for ETH_STATE_ACTIVE.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
include/net.h
net/eth.c