From b86f795a378fdeb873cdc464367660fb3b49c443 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 6 Jul 2015 16:47:55 -0600 Subject: net: Allow drivers to return -ENOSYS with the write_hwaddr() method Some drivers may want to implement this method for some of their devices but not for others. So it is not possible to just leave the operation out of the table. Drivers could get around this by masquerading as two separate drivers but that seems unpleasant. Allow the driver to return an error when it does not want to process the write_hwaddr() method. Signed-off-by: Simon Glass --- net/eth.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'net') diff --git a/net/eth.c b/net/eth.c index 72ce91c..d3ec8d6 100644 --- a/net/eth.c +++ b/net/eth.c @@ -287,7 +287,13 @@ static int eth_write_hwaddr(struct udevice *dev) return -EINVAL; } + /* + * 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; if (ret) printf("\nWarning: %s failed to set MAC address\n", dev->name); -- cgit v1.1