drivers/video/msm: update to new kernel
[safe/jmp/linux-2.6] / drivers / net / dummy.c
index 373ff70..37dcfdc 100644 (file)
@@ -39,8 +39,6 @@
 
 static int numdummies = 1;
 
-static int dummy_xmit(struct sk_buff *skb, struct net_device *dev);
-
 static int dummy_set_address(struct net_device *dev, void *p)
 {
        struct sockaddr *sa = p;
@@ -57,36 +55,52 @@ static void set_multicast_list(struct net_device *dev)
 {
 }
 
+
+static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += skb->len;
+
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
+}
+
+static const struct net_device_ops dummy_netdev_ops = {
+       .ndo_start_xmit         = dummy_xmit,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_set_mac_address    = dummy_set_address,
+};
+
 static void dummy_setup(struct net_device *dev)
 {
+       ether_setup(dev);
+
        /* Initialize the device structure. */
-       dev->hard_start_xmit = dummy_xmit;
-       dev->set_multicast_list = set_multicast_list;
-       dev->set_mac_address = dummy_set_address;
+       dev->netdev_ops = &dummy_netdev_ops;
        dev->destructor = free_netdev;
 
        /* Fill in device structure with ethernet-generic values. */
-       ether_setup(dev);
        dev->tx_queue_len = 0;
-       dev->change_mtu = NULL;
        dev->flags |= IFF_NOARP;
        dev->flags &= ~IFF_MULTICAST;
-       SET_MODULE_OWNER(dev);
        random_ether_addr(dev->dev_addr);
 }
-
-static int dummy_xmit(struct sk_buff *skb, struct net_device *dev)
+static int dummy_validate(struct nlattr *tb[], struct nlattr *data[])
 {
-       dev->stats.tx_packets++;
-       dev->stats.tx_bytes += skb->len;
-
-       dev_kfree_skb(skb);
+       if (tb[IFLA_ADDRESS]) {
+               if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
+                       return -EINVAL;
+               if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+                       return -EADDRNOTAVAIL;
+       }
        return 0;
 }
 
 static struct rtnl_link_ops dummy_link_ops __read_mostly = {
        .kind           = "dummy",
        .setup          = dummy_setup,
+       .validate       = dummy_validate,
 };
 
 /* Number of dummy devices to be set up by this module. */