[U-Boot] [RFC] net: eth_write_hwaddr hides ENOSYS

Simon Glass sjg at chromium.org
Fri Mar 30 08:42:02 UTC 2018


Hi Heinrich,

On 24 March 2018 at 21:41, Heinrich Schuchardt <xypron.debian at gmx.de> wrote:
> Hello Simon,
>
> in patch
> db9391e165dd ("net: Move driver-model code into its own file")
> function eth_write_hwaddr hides() you chose to introduce the follwing lines:
>
> static int eth_write_hwaddr(struct udevice *dev)
> ...
> /*
>  * Drivers are allowed to decide not to implement this at
>  * run-time. E.g. Some devices may use it and some may not.
>  */
> ret = eth_get_ops(dev)->write_hwaddr(dev);
> if (ret == -ENOSYS)
>         ret = 0;
>
> For implementing efi_net_station_address() it would be preferable if the
> function would return -ENOSYS to signal that changing the MAC address
> failed.

Actually -ENOSYS if the method is not implemented, and -ENXIO or
something if the write failed.

There is a clear distinction between:

* -ENOSYS the method is not implemented (so you might choose to not
worry about the error)
* -Esomething_else - the method is implemented, but failed (so you
probably want to return an error)

>
> I could not find any caller of the driver model version of
> eth_write_hwaddr(). Do you remember why you made this choice?
>
> Best regards
>
> Heinrich

Regards,
Simon


More information about the U-Boot mailing list