aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-09-17 08:43:14 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-09-17 08:43:14 +0000
commitb07d307d3fe1d4cb8c7c609cdac5d37ff4350cab (patch)
treeec4d57f8b00affcc0d6a869258797a166ba93777 /target
parentdc3a658baffb3718df137bdfcb89f264ca90f179 (diff)
downloadupstream-b07d307d3fe1d4cb8c7c609cdac5d37ff4350cab.tar.gz
upstream-b07d307d3fe1d4cb8c7c609cdac5d37ff4350cab.tar.bz2
upstream-b07d307d3fe1d4cb8c7c609cdac5d37ff4350cab.zip
adm5120: use netdev_ops on kernels >= 2.6.30 (based on a patch by Alexandros C. Couloumbis, closes #5846)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17601 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/adm5120/patches-2.6.30/810-adm5120sw-netdev_ops.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/target/linux/adm5120/patches-2.6.30/810-adm5120sw-netdev_ops.patch b/target/linux/adm5120/patches-2.6.30/810-adm5120sw-netdev_ops.patch
new file mode 100644
index 0000000000..ae116509cb
--- /dev/null
+++ b/target/linux/adm5120/patches-2.6.30/810-adm5120sw-netdev_ops.patch
@@ -0,0 +1,52 @@
+--- a/drivers/net/adm5120sw.c
++++ b/drivers/net/adm5120sw.c
+@@ -973,9 +973,12 @@ static void adm5120_if_set_multicast_lis
+
+ static int adm5120_if_set_mac_address(struct net_device *dev, void *p)
+ {
+- struct sockaddr *addr = p;
++ int ret;
++
++ ret = eth_mac_addr(dev, p);
++ if (ret)
++ return ret;
+
+- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ adm5120_write_mac(dev);
+ return 0;
+ }
+@@ -1017,6 +1020,18 @@ static int adm5120_if_do_ioctl(struct ne
+ return 0;
+ }
+
++static const struct net_device_ops adm5120sw_netdev_ops = {
++ .ndo_open = adm5120_if_open,
++ .ndo_stop = adm5120_if_stop,
++ .ndo_start_xmit = adm5120_if_hard_start_xmit,
++ .ndo_set_multicast_list = adm5120_if_set_multicast_list,
++ .ndo_do_ioctl = adm5120_if_do_ioctl,
++ .ndo_tx_timeout = adm5120_if_tx_timeout,
++ .ndo_validate_addr = eth_validate_addr,
++ .ndo_change_mtu = eth_change_mtu,
++ .ndo_set_mac_address = adm5120_if_set_mac_address,
++};
++
+ static struct net_device *adm5120_if_alloc(void)
+ {
+ struct net_device *dev;
+@@ -1030,14 +1045,8 @@ static struct net_device *adm5120_if_all
+ priv->dev = dev;
+
+ dev->irq = ADM5120_IRQ_SWITCH;
+- dev->open = adm5120_if_open;
+- dev->hard_start_xmit = adm5120_if_hard_start_xmit;
+- dev->stop = adm5120_if_stop;
+- dev->set_multicast_list = adm5120_if_set_multicast_list;
+- dev->do_ioctl = adm5120_if_do_ioctl;
+- dev->tx_timeout = adm5120_if_tx_timeout;
++ dev->netdev_ops = &adm5120sw_netdev_ops;
+ dev->watchdog_timeo = TX_TIMEOUT;
+- dev->set_mac_address = adm5120_if_set_mac_address;
+
+ #ifdef CONFIG_ADM5120_SWITCH_NAPI
+ netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64);