[U-Boot] [RFC PATCH 1/3] expose eth_is_active() function to test network device state

Simon Glass sjg at chromium.org
Sun Aug 23 23:21:42 CEST 2015


Hi Bernard,

On 21 August 2015 at 16:30, Bernhard Nortmann <bernhard.nortmann at web.de> wrote:
> 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 at web.de>
> ---
>
>  include/net.h |  6 ++++++
>  net/eth.c     | 18 +++++++++++++++++-
>  2 files changed, 23 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

A few points:

- You should tag your patch with the subsystem it targets - in your
case I think you should prefix the subject with 'net: '
- Do you have a patch to enable netconsole on an existing board? If
the code you add is never built then it could break at any moment

Regards,
Simon


More information about the U-Boot mailing list