aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Martin <oliver.martin@student.tuwien.ac.at>2008-08-23 16:08:47 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-08-27 05:54:57 -0400
commit1025433147e635af9cd150676a097396cf666ddb (patch)
treee91dec9b5ac553901711d1fca79d0de521863508
parent8382cc1c2d0eb8918d3b71bf6cb8ac2e883f3e33 (diff)
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>
-rw-r--r--drivers/net/usb/mcs7830.c24
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 = {
446 .nway_reset = usbnet_nway_reset, 446 .nway_reset = usbnet_nway_reset,
447}; 447};
448 448
449static int mcs7830_set_mac_address(struct net_device *netdev, void *p)
450{
451 int ret;
452 struct usbnet *dev = netdev_priv(netdev);
453 struct sockaddr *addr = p;
454
455 if (netif_running(netdev))
456 return -EBUSY;
457
458 if (!is_valid_ether_addr(addr->sa_data))
459 return -EINVAL;
460
461 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
462
463 ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN,
464 netdev->dev_addr);
465
466 if (ret < 0)
467 return ret;
468
469 return 0;
470}
471
449static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) 472static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
450{ 473{
451 struct net_device *net = dev->net; 474 struct net_device *net = dev->net;
@@ -459,6 +482,7 @@ static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
459 net->ethtool_ops = &mcs7830_ethtool_ops; 482 net->ethtool_ops = &mcs7830_ethtool_ops;
460 net->set_multicast_list = mcs7830_set_multicast; 483 net->set_multicast_list = mcs7830_set_multicast;
461 mcs7830_set_multicast(net); 484 mcs7830_set_multicast(net);
485 net->set_mac_address = mcs7830_set_mac_address;
462 486
463 /* reserve space for the status byte on rx */ 487 /* reserve space for the status byte on rx */
464 dev->rx_urb_size = ETH_FRAME_LEN + 1; 488 dev->rx_urb_size = ETH_FRAME_LEN + 1;