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

2018-03-30 Thread Simon Glass
Hi Heinrich,

On 24 March 2018 at 21:41, Heinrich Schuchardt  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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-03-24 Thread Heinrich Schuchardt
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.

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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot