ae116509cb1bd2d93adead713729a1b90bc9f5df
[openwrt/openwrt.git] / target / linux / adm5120 / patches-2.6.30 / 810-adm5120sw-netdev_ops.patch
1 --- a/drivers/net/adm5120sw.c
2 +++ b/drivers/net/adm5120sw.c
3 @@ -973,9 +973,12 @@ static void adm5120_if_set_multicast_lis
4
5 static int adm5120_if_set_mac_address(struct net_device *dev, void *p)
6 {
7 - struct sockaddr *addr = p;
8 + int ret;
9 +
10 + ret = eth_mac_addr(dev, p);
11 + if (ret)
12 + return ret;
13
14 - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
15 adm5120_write_mac(dev);
16 return 0;
17 }
18 @@ -1017,6 +1020,18 @@ static int adm5120_if_do_ioctl(struct ne
19 return 0;
20 }
21
22 +static const struct net_device_ops adm5120sw_netdev_ops = {
23 + .ndo_open = adm5120_if_open,
24 + .ndo_stop = adm5120_if_stop,
25 + .ndo_start_xmit = adm5120_if_hard_start_xmit,
26 + .ndo_set_multicast_list = adm5120_if_set_multicast_list,
27 + .ndo_do_ioctl = adm5120_if_do_ioctl,
28 + .ndo_tx_timeout = adm5120_if_tx_timeout,
29 + .ndo_validate_addr = eth_validate_addr,
30 + .ndo_change_mtu = eth_change_mtu,
31 + .ndo_set_mac_address = adm5120_if_set_mac_address,
32 +};
33 +
34 static struct net_device *adm5120_if_alloc(void)
35 {
36 struct net_device *dev;
37 @@ -1030,14 +1045,8 @@ static struct net_device *adm5120_if_all
38 priv->dev = dev;
39
40 dev->irq = ADM5120_IRQ_SWITCH;
41 - dev->open = adm5120_if_open;
42 - dev->hard_start_xmit = adm5120_if_hard_start_xmit;
43 - dev->stop = adm5120_if_stop;
44 - dev->set_multicast_list = adm5120_if_set_multicast_list;
45 - dev->do_ioctl = adm5120_if_do_ioctl;
46 - dev->tx_timeout = adm5120_if_tx_timeout;
47 + dev->netdev_ops = &adm5120sw_netdev_ops;
48 dev->watchdog_timeo = TX_TIMEOUT;
49 - dev->set_mac_address = adm5120_if_set_mac_address;
50
51 #ifdef CONFIG_ADM5120_SWITCH_NAPI
52 netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64);