Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[safe/jmp/linux-2.6] / drivers / firewire / net.c
index 95e35a3..cbaf420 100644 (file)
@@ -663,8 +663,6 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
        if (netif_queue_stopped(net))
                netif_wake_queue(net);
 
-       net->last_rx = jiffies;
-
        return 0;
 }
 
@@ -810,29 +808,27 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r,
                int speed, unsigned long long offset, void *payload,
                size_t length, void *callback_data)
 {
-       struct fwnet_device *dev;
-       int status;
+       struct fwnet_device *dev = callback_data;
+       int rcode;
 
-       dev = callback_data;
-       if (tcode != TCODE_WRITE_BLOCK_REQUEST
-           || destination != card->node_id     /* <- FIXME */
-           || generation != card->generation   /* <- FIXME */
-           || offset != dev->handler.offset) {
-               fw_send_response(card, r, RCODE_CONFLICT_ERROR);
+       if (destination == IEEE1394_ALL_NODES) {
+               kfree(r);
 
                return;
        }
 
-       status = fwnet_incoming_packet(dev, payload, length,
-                                      source, generation, false);
-       if (status != 0) {
+       if (offset != dev->handler.offset)
+               rcode = RCODE_ADDRESS_ERROR;
+       else if (tcode != TCODE_WRITE_BLOCK_REQUEST)
+               rcode = RCODE_TYPE_ERROR;
+       else if (fwnet_incoming_packet(dev, payload, length,
+                                      source, generation, false) != 0) {
                fw_error("Incoming packet failure\n");
-               fw_send_response(card, r, RCODE_CONFLICT_ERROR);
+               rcode = RCODE_CONFLICT_ERROR;
+       } else
+               rcode = RCODE_COMPLETE;
 
-               return;
-       }
-
-       fw_send_response(card, r, RCODE_COMPLETE);
+       fw_send_response(card, r, rcode);
 }
 
 static void fwnet_receive_broadcast(struct fw_iso_context *context,
@@ -1190,7 +1186,7 @@ static int fwnet_stop(struct net_device *net)
        return 0;
 }
 
-static int fwnet_tx(struct sk_buff *skb, struct net_device *net)
+static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
 {
        struct fwnet_header hdr_buf;
        struct fwnet_device *dev = netdev_priv(net);
@@ -1344,7 +1340,7 @@ static void fwnet_get_drvinfo(struct net_device *net,
        strcpy(info->bus_info, "ieee1394");
 }
 
-static struct ethtool_ops fwnet_ethtool_ops = {
+static const struct ethtool_ops fwnet_ethtool_ops = {
        .get_drvinfo = fwnet_get_drvinfo,
 };
 
@@ -1390,7 +1386,8 @@ static int fwnet_add_peer(struct fwnet_device *dev,
        if (!peer)
                return -ENOMEM;
 
-       unit->device.driver_data = peer;
+       dev_set_drvdata(&unit->device, peer);
+
        peer->dev = dev;
        peer->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4];
        peer->fifo = FWNET_NO_FIFO_ADDR;
@@ -1417,27 +1414,26 @@ static int fwnet_probe(struct device *_dev)
        struct fw_device *device = fw_parent_device(unit);
        struct fw_card *card = device->card;
        struct net_device *net;
+       bool allocated_netdev = false;
        struct fwnet_device *dev;
        unsigned max_mtu;
-       bool new_netdev;
        int ret;
 
        mutex_lock(&fwnet_device_mutex);
 
        dev = fwnet_dev_find(card);
        if (dev) {
-               new_netdev = false;
                net = dev->netdev;
                goto have_dev;
        }
 
-       new_netdev = true;
        net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
        if (net == NULL) {
                ret = -ENOMEM;
                goto out;
        }
 
+       allocated_netdev = true;
        SET_NETDEV_DEV(net, card->device);
        dev = netdev_priv(net);
 
@@ -1479,12 +1475,12 @@ static int fwnet_probe(struct device *_dev)
                  net->name, (unsigned long long)card->guid);
  have_dev:
        ret = fwnet_add_peer(dev, unit, device);
-       if (ret && new_netdev) {
+       if (ret && allocated_netdev) {
                unregister_netdev(net);
                list_del(&dev->dev_link);
        }
  out:
-       if (ret && new_netdev)
+       if (ret && allocated_netdev)
                free_netdev(net);
 
        mutex_unlock(&fwnet_device_mutex);
@@ -1508,7 +1504,7 @@ static void fwnet_remove_peer(struct fwnet_peer *peer)
 
 static int fwnet_remove(struct device *_dev)
 {
-       struct fwnet_peer *peer = _dev->driver_data;
+       struct fwnet_peer *peer = dev_get_drvdata(_dev);
        struct fwnet_device *dev = peer->dev;
        struct net_device *net;
        struct fwnet_packet_task *ptask, *pt_next;
@@ -1544,6 +1540,8 @@ static int fwnet_remove(struct device *_dev)
                        dev_kfree_skb_any(ptask->skb);
                        kmem_cache_free(fwnet_packet_task_cache, ptask);
                }
+               list_del(&dev->dev_link);
+
                free_netdev(net);
        }
 
@@ -1559,7 +1557,7 @@ static int fwnet_remove(struct device *_dev)
 static void fwnet_update(struct fw_unit *unit)
 {
        struct fw_device *device = fw_parent_device(unit);
-       struct fwnet_peer *peer = unit->device.driver_data;
+       struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
        int generation;
 
        generation = device->generation;