netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mcs7830: add set_mac_address
@ 2008-08-23 18:01 Oliver Martin
  2008-08-23 19:59 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Martin @ 2008-08-23 18:01 UTC (permalink / raw)
  To: netdev; +Cc: arnd

Implement set_mac_address for mcs7830. This enables me to use it with my
cable modem. Tested (and using it right now) with 2.6.26, tested to
compile with 2.6.27-rc4

Signed-off-by: Oliver Martin <oliver.martin@student.tuwien.ac.at>

--- linux-2.6.26/drivers/net/usb/mcs7830.c.orig	2008-08-23 01:44:26.000000000 +0200
+++ linux-2.6.26/drivers/net/usb/mcs7830.c	2008-08-23 02:26:28.000000000 +0200
@@ -442,6 +442,29 @@ static struct ethtool_ops mcs7830_ethtoo
 	.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;
@@ -455,6 +478,7 @@ static int mcs7830_bind(struct usbnet *d
 	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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mcs7830: add set_mac_address
  2008-08-23 18:01 [PATCH] mcs7830: add set_mac_address Oliver Martin
@ 2008-08-23 19:59 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2008-08-23 19:59 UTC (permalink / raw)
  To: Oliver Martin; +Cc: netdev

On Saturday 23 August 2008, you wrote:
> Implement set_mac_address for mcs7830. This enables me to use it with my
> cable modem. Tested (and using it right now) with 2.6.26, tested to
> compile with 2.6.27-rc4

Looks good, thanks!

> Signed-off-by: Oliver Martin <oliver.martin@student.tuwien.ac.at>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-23 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-23 18:01 [PATCH] mcs7830: add set_mac_address Oliver Martin
2008-08-23 19:59 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).