summaryrefslogtreecommitdiff
path: root/drivers/net/usb/dm9601.c
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2008-10-24 09:08:27 +0200
committerJeff Garzik <jgarzik@redhat.com>2008-10-27 15:13:29 -0400
commit753dcfeecc0e293dbe6f3d59643741af9e610f4f (patch)
tree7f0c762d17f7f9dd38e60a7ae32d5d2962984bb2 /drivers/net/usb/dm9601.c
parent07b5f6a6fd0ce47390f7fbec966cd5c70127e597 (diff)
dm9601: runtime mac address change support
Implement set_mac_address for runtime mac address change. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/usb/dm9601.c')
-rw-r--r--drivers/net/usb/dm9601.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 78df2be8a728..db3377dae9d5 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -396,6 +396,20 @@ static void dm9601_set_multicast(struct net_device *net)
dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
}
+static int dm9601_set_mac_address(struct net_device *net, void *p)
+{
+ struct sockaddr *addr = p;
+ struct usbnet *dev = netdev_priv(net);
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EINVAL;
+
+ memcpy(net->dev_addr, addr->sa_data, net->addr_len);
+ dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr);
+
+ return 0;
+}
+
static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
{
int ret;
@@ -406,6 +420,7 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
dev->net->do_ioctl = dm9601_ioctl;
dev->net->set_multicast_list = dm9601_set_multicast;
+ dev->net->set_mac_address = dm9601_set_mac_address;
dev->net->ethtool_ops = &dm9601_ethtool_ops;
dev->net->hard_header_len += DM_TX_OVERHEAD;
dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;