staging: et131x: Use eth_mac_addr() instead of duplicating the functionality
There's already working code to set the mac address, so let's use it. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
71f81efb22
commit
36087dc1ed
1 changed files with 1 additions and 52 deletions
|
@ -4481,57 +4481,6 @@ static int et131x_change_mtu(struct net_device *netdev, int new_mtu)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* et131x_set_mac_addr - handler to change the MAC address for the device */
|
|
||||||
static int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
struct et131x_adapter *adapter = netdev_priv(netdev);
|
|
||||||
struct sockaddr *address = new_mac;
|
|
||||||
|
|
||||||
if (adapter == NULL)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* Make sure the requested MAC is valid */
|
|
||||||
if (!is_valid_ether_addr(address->sa_data))
|
|
||||||
return -EADDRNOTAVAIL;
|
|
||||||
|
|
||||||
et131x_disable_txrx(netdev);
|
|
||||||
et131x_handle_send_interrupt(adapter);
|
|
||||||
et131x_handle_recv_interrupt(adapter);
|
|
||||||
|
|
||||||
/* Set the new MAC */
|
|
||||||
/* netdev->set_mac_address = &new_mac; */
|
|
||||||
|
|
||||||
memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len);
|
|
||||||
|
|
||||||
netdev_info(netdev, "Setting MAC address to %pM\n",
|
|
||||||
netdev->dev_addr);
|
|
||||||
|
|
||||||
/* Free Rx DMA memory */
|
|
||||||
et131x_adapter_memory_free(adapter);
|
|
||||||
|
|
||||||
et131x_soft_reset(adapter);
|
|
||||||
|
|
||||||
/* Alloc and init Rx DMA memory */
|
|
||||||
result = et131x_adapter_memory_alloc(adapter);
|
|
||||||
if (result != 0) {
|
|
||||||
dev_err(&adapter->pdev->dev,
|
|
||||||
"Change MAC failed; couldn't re-alloc DMA memory\n");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
et131x_init_send(adapter);
|
|
||||||
|
|
||||||
et131x_hwaddr_init(adapter);
|
|
||||||
|
|
||||||
/* Init the device with the new settings */
|
|
||||||
et131x_adapter_setup(adapter);
|
|
||||||
|
|
||||||
et131x_enable_txrx(netdev);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct net_device_ops et131x_netdev_ops = {
|
static const struct net_device_ops et131x_netdev_ops = {
|
||||||
.ndo_open = et131x_open,
|
.ndo_open = et131x_open,
|
||||||
.ndo_stop = et131x_close,
|
.ndo_stop = et131x_close,
|
||||||
|
@ -4539,7 +4488,7 @@ static const struct net_device_ops et131x_netdev_ops = {
|
||||||
.ndo_set_rx_mode = et131x_multicast,
|
.ndo_set_rx_mode = et131x_multicast,
|
||||||
.ndo_tx_timeout = et131x_tx_timeout,
|
.ndo_tx_timeout = et131x_tx_timeout,
|
||||||
.ndo_change_mtu = et131x_change_mtu,
|
.ndo_change_mtu = et131x_change_mtu,
|
||||||
.ndo_set_mac_address = et131x_set_mac_addr,
|
.ndo_set_mac_address = eth_mac_addr,
|
||||||
.ndo_validate_addr = eth_validate_addr,
|
.ndo_validate_addr = eth_validate_addr,
|
||||||
.ndo_get_stats = et131x_stats,
|
.ndo_get_stats = et131x_stats,
|
||||||
.ndo_do_ioctl = et131x_ioctl,
|
.ndo_do_ioctl = et131x_ioctl,
|
||||||
|
|
Loading…
Add table
Reference in a new issue