diff options
author | Oliver Martin <oliver.martin@student.tuwien.ac.at> | 2008-08-23 22:08:47 +0200 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-08-27 05:54:57 -0400 |
commit | 1025433147e635af9cd150676a097396cf666ddb (patch) | |
tree | e91dec9b5ac553901711d1fca79d0de521863508 /drivers/net/usb | |
parent | 8382cc1c2d0eb8918d3b71bf6cb8ac2e883f3e33 (diff) | |
download | blackbird-op-linux-1025433147e635af9cd150676a097396cf666ddb.tar.gz blackbird-op-linux-1025433147e635af9cd150676a097396cf666ddb.zip |
net/usb/mcs7830: add set_mac_address
Implement set_mac_address for mcs7830. This enables me to use it with my
cable modem.
Signed-off-by: Oliver Martin <oliver.martin@student.tuwien.ac.at>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/mcs7830.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index ebf1332abaa1..ca9d00c1194e 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -446,6 +446,29 @@ static struct ethtool_ops mcs7830_ethtool_ops = { .nway_reset = usbnet_nway_reset, }; +static int mcs7830_set_mac_address(struct net_device *netdev, void *p) +{ + int ret; + struct usbnet *dev = netdev_priv(netdev); + struct sockaddr *addr = p; + + if (netif_running(netdev)) + return -EBUSY; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EINVAL; + + memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); + + ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, + netdev->dev_addr); + + if (ret < 0) + return ret; + + return 0; +} + static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) { struct net_device *net = dev->net; @@ -459,6 +482,7 @@ static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) net->ethtool_ops = &mcs7830_ethtool_ops; net->set_multicast_list = mcs7830_set_multicast; mcs7830_set_multicast(net); + net->set_mac_address = mcs7830_set_mac_address; /* reserve space for the status byte on rx */ dev->rx_urb_size = ETH_FRAME_LEN + 1; |