]> Pileus Git - ~andy/linux/blobdiff - drivers/ieee1394/eth1394.c
Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[~andy/linux] / drivers / ieee1394 / eth1394.c
index a074bfd5f8258cc4b1d0b3099f56fbd92c65ed38..f5c586c2bba658cdfbef07d7e268431c0f64bfdb 100644 (file)
@@ -181,7 +181,7 @@ static void ether1394_remove_host(struct hpsb_host *host);
 static void ether1394_host_reset(struct hpsb_host *host);
 
 /* Function for incoming 1394 packets */
-const static struct hpsb_address_ops addr_ops = {
+static const struct hpsb_address_ops addr_ops = {
        .write =        ether1394_write,
 };
 
@@ -245,12 +245,6 @@ static int ether1394_stop(struct net_device *dev)
        return 0;
 }
 
-/* Return statistics to the caller */
-static struct net_device_stats *ether1394_stats(struct net_device *dev)
-{
-       return &(((struct eth1394_priv *)netdev_priv(dev))->stats);
-}
-
 /* FIXME: What to do if we timeout? I think a host reset is probably in order,
  * so that's what we do. Should we increment the stat counters too?  */
 static void ether1394_tx_timeout(struct net_device *dev)
@@ -367,7 +361,7 @@ static int eth1394_new_node(struct eth1394_host_info *hi,
        node_info->pdg.sz = 0;
        node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
 
-       ud->device.driver_data = node_info;
+       dev_set_drvdata(&ud->device, node_info);
        new_node->ud = ud;
 
        priv = netdev_priv(hi->dev);
@@ -412,7 +406,7 @@ static int eth1394_remove(struct device *dev)
        list_del(&old_node->list);
        kfree(old_node);
 
-       node_info = (struct eth1394_node_info*)ud->device.driver_data;
+       node_info = dev_get_drvdata(&ud->device);
 
        spin_lock_irqsave(&node_info->pdg.lock, flags);
        /* The partial datagram list should be empty, but we'll just
@@ -422,7 +416,7 @@ static int eth1394_remove(struct device *dev)
        spin_unlock_irqrestore(&node_info->pdg.lock, flags);
 
        kfree(node_info);
-       ud->device.driver_data = NULL;
+       dev_set_drvdata(&ud->device, NULL);
        return 0;
 }
 
@@ -444,7 +438,7 @@ static int eth1394_update(struct unit_directory *ud)
        return eth1394_new_node(hi, ud);
 }
 
-static struct ieee1394_device_id eth1394_id_table[] = {
+static const struct ieee1394_device_id eth1394_id_table[] = {
        {
                .match_flags = (IEEE1394_MATCH_SPECIFIER_ID |
                                IEEE1394_MATCH_VERSION),
@@ -516,16 +510,19 @@ static const struct header_ops ether1394_header_ops = {
        .parse          = ether1394_header_parse,
 };
 
+static const struct net_device_ops ether1394_netdev_ops = {
+       .ndo_open       = ether1394_open,
+       .ndo_stop       = ether1394_stop,
+       .ndo_start_xmit = ether1394_tx,
+       .ndo_tx_timeout = ether1394_tx_timeout,
+       .ndo_change_mtu = ether1394_change_mtu,
+};
+
 static void ether1394_init_dev(struct net_device *dev)
 {
-       dev->open               = ether1394_open;
-       dev->stop               = ether1394_stop;
-       dev->hard_start_xmit    = ether1394_tx;
-       dev->get_stats          = ether1394_stats;
-       dev->tx_timeout         = ether1394_tx_timeout;
-       dev->change_mtu         = ether1394_change_mtu;
 
        dev->header_ops         = &ether1394_header_ops;
+       dev->netdev_ops         = &ether1394_netdev_ops;
 
        SET_ETHTOOL_OPS(dev, &ethtool_ops);
 
@@ -691,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host)
        ether1394_reset_priv(dev, 0);
 
        list_for_each_entry(node, &priv->ip_node_list, list) {
-               node_info = node->ud->device.driver_data;
+               node_info = dev_get_drvdata(&node->ud->device);
 
                spin_lock_irqsave(&node_info->pdg.lock, flags);
 
@@ -875,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
                if (!node)
                        return cpu_to_be16(0);
 
-               node_info =
-                   (struct eth1394_node_info *)node->ud->device.driver_data;
+               node_info = dev_get_drvdata(&node->ud->device);
 
                /* Update our speed/payload/fifo_offset table */
                node_info->maxpayload = maxpayload;
@@ -1075,7 +1071,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
                        HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid "
                                   "lookup failure: " NODE_BUS_FMT,
                                   NODE_BUS_ARGS(priv->host, srcid));
-                       priv->stats.rx_dropped++;
+                       dev->stats.rx_dropped++;
                        return -1;
                }
                ud = node->ud;
@@ -1083,7 +1079,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
                priv->ud_list[NODEID_TO_NODE(srcid)] = ud;
        }
 
-       node_info = (struct eth1394_node_info *)ud->device.driver_data;
+       node_info = dev_get_drvdata(&ud->device);
 
        /* First, did we receive a fragmented or unfragmented datagram? */
        hdr->words.word1 = ntohs(hdr->words.word1);
@@ -1098,7 +1094,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
                skb = dev_alloc_skb(len + dev->hard_header_len + 15);
                if (unlikely(!skb)) {
                        ETH1394_PRINT_G(KERN_ERR, "Out of memory\n");
-                       priv->stats.rx_dropped++;
+                       dev->stats.rx_dropped++;
                        return -1;
                }
                skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
@@ -1217,15 +1213,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
        spin_lock_irqsave(&priv->lock, flags);
 
        if (!skb->protocol) {
-               priv->stats.rx_errors++;
-               priv->stats.rx_dropped++;
+               dev->stats.rx_errors++;
+               dev->stats.rx_dropped++;
                dev_kfree_skb_any(skb);
        } else if (netif_rx(skb) == NET_RX_DROP) {
-               priv->stats.rx_errors++;
-               priv->stats.rx_dropped++;
+               dev->stats.rx_errors++;
+               dev->stats.rx_dropped++;
        } else {
-               priv->stats.rx_packets++;
-               priv->stats.rx_bytes += skb->len;
+               dev->stats.rx_packets++;
+               dev->stats.rx_bytes += skb->len;
        }
 
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -1234,8 +1230,6 @@ bad_proto:
        if (netif_queue_stopped(dev))
                netif_wake_queue(dev);
 
-       dev->last_rx = jiffies;
-
        return 0;
 }
 
@@ -1509,17 +1503,18 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len)
 static void ether1394_dg_complete(struct packet_task *ptask, int fail)
 {
        struct sk_buff *skb = ptask->skb;
-       struct eth1394_priv *priv = netdev_priv(skb->dev);
+       struct net_device *dev = skb->dev;
+       struct eth1394_priv *priv = netdev_priv(dev);
        unsigned long flags;
 
        /* Statistics */
        spin_lock_irqsave(&priv->lock, flags);
        if (fail) {
-               priv->stats.tx_dropped++;
-               priv->stats.tx_errors++;
+               dev->stats.tx_dropped++;
+               dev->stats.tx_errors++;
        } else {
-               priv->stats.tx_bytes += skb->len;
-               priv->stats.tx_packets++;
+               dev->stats.tx_bytes += skb->len;
+               dev->stats.tx_packets++;
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
@@ -1621,8 +1616,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
                if (!node)
                        goto fail;
 
-               node_info =
-                   (struct eth1394_node_info *)node->ud->device.driver_data;
+               node_info = dev_get_drvdata(&node->ud->device);
                if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE)
                        goto fail;
 
@@ -1696,8 +1690,8 @@ fail:
                dev_kfree_skb(skb);
 
        spin_lock_irqsave(&priv->lock, flags);
-       priv->stats.tx_dropped++;
-       priv->stats.tx_errors++;
+       dev->stats.tx_dropped++;
+       dev->stats.tx_errors++;
        spin_unlock_irqrestore(&priv->lock, flags);
 
        /*