diff options
author | Patrick Ziegler <patrick.ziegler@fh-kl.de> | 2013-08-15 14:40:09 +0200 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-08-15 19:56:27 -0700 |
commit | 521acfd92f168fc9b8b6a1cefe9a165243f3d872 (patch) | |
tree | f7212b8cd21940cb189901b277000883c342409a /backport/compat | |
parent | 27a8741e3312871854711f4699feed58c0b5d699 (diff) |
backports: add eth_prepare_mac_addr_change() and eth_commit_mac_addr_change()
These functions are required by qmi_wwan device driver.
Signed-off-by: Patrick Ziegler <patrick.ziegler@fh-kl.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'backport/compat')
-rw-r--r-- | backport/compat/compat-3.9.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/backport/compat/compat-3.9.c b/backport/compat/compat-3.9.c index 03f3af8a..ba8e3cf4 100644 --- a/backport/compat/compat-3.9.c +++ b/backport/compat/compat-3.9.c @@ -12,6 +12,9 @@ #include <linux/scatterlist.h> #include <linux/device.h> #include <linux/err.h> +#include <linux/netdevice.h> +#include <linux/if.h> +#include <linux/if_ether.h> #ifdef __sg_page_iter_next @@ -64,4 +67,34 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res) } EXPORT_SYMBOL_GPL(devm_ioremap_resource); +/** + * eth_prepare_mac_addr_change - prepare for mac change + * @dev: network device + * @p: socket address + */ +int eth_prepare_mac_addr_change(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + + if (!(dev->priv_flags & IFF_LIVE_ADDR_CHANGE) && netif_running(dev)) + return -EBUSY; + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + return 0; +} +EXPORT_SYMBOL_GPL(eth_prepare_mac_addr_change); + +/** + * eth_commit_mac_addr_change - commit mac change + * @dev: network device + * @p: socket address + */ +void eth_commit_mac_addr_change(struct net_device *dev, void *p) +{ + struct sockaddr *addr = p; + + memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); +} +EXPORT_SYMBOL_GPL(eth_commit_mac_addr_change); + #endif /* __sg_page_iter_next */ |