usb: dwc3: fix logical error during controller probe
[firefly-linux-kernel-4.4.55.git] / drivers / firewire / net.c
index 7bdb6fe63236f16a3fc3f5d780c69202418b2af3..f4ea80d602f73bd6bc5adac2a32bbbe2b58de716 100644 (file)
@@ -237,18 +237,6 @@ static int fwnet_header_create(struct sk_buff *skb, struct net_device *net,
        return -net->hard_header_len;
 }
 
-static int fwnet_header_rebuild(struct sk_buff *skb)
-{
-       struct fwnet_header *h = (struct fwnet_header *)skb->data;
-
-       if (get_unaligned_be16(&h->h_proto) == ETH_P_IP)
-               return arp_find((unsigned char *)&h->h_dest, skb);
-
-       dev_notice(&skb->dev->dev, "unable to resolve type %04x addresses\n",
-                  be16_to_cpu(h->h_proto));
-       return 0;
-}
-
 static int fwnet_header_cache(const struct neighbour *neigh,
                              struct hh_cache *hh, __be16 type)
 {
@@ -282,7 +270,6 @@ static int fwnet_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 
 static const struct header_ops fwnet_header_ops = {
        .create         = fwnet_header_create,
-       .rebuild        = fwnet_header_rebuild,
        .cache          = fwnet_header_cache,
        .cache_update   = fwnet_header_cache_update,
        .parse          = fwnet_header_parse,
@@ -1440,9 +1427,9 @@ static int fwnet_add_peer(struct fwnet_device *dev,
        return 0;
 }
 
-static int fwnet_probe(struct device *_dev)
+static int fwnet_probe(struct fw_unit *unit,
+                      const struct ieee1394_device_id *id)
 {
-       struct fw_unit *unit = fw_unit(_dev);
        struct fw_device *device = fw_parent_device(unit);
        struct fw_card *card = device->card;
        struct net_device *net;
@@ -1460,10 +1447,11 @@ static int fwnet_probe(struct device *_dev)
                goto have_dev;
        }
 
-       net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
+       net = alloc_netdev(sizeof(*dev), "firewire%d", NET_NAME_UNKNOWN,
+                          fwnet_init_dev);
        if (net == NULL) {
-               ret = -ENOMEM;
-               goto out;
+               mutex_unlock(&fwnet_device_mutex);
+               return -ENOMEM;
        }
 
        allocated_netdev = true;
@@ -1526,6 +1514,24 @@ static int fwnet_probe(struct device *_dev)
        return ret;
 }
 
+/*
+ * FIXME abort partially sent fragmented datagrams,
+ * discard partially received fragmented datagrams
+ */
+static void fwnet_update(struct fw_unit *unit)
+{
+       struct fw_device *device = fw_parent_device(unit);
+       struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
+       int generation;
+
+       generation = device->generation;
+
+       spin_lock_irq(&peer->dev->lock);
+       peer->node_id    = device->node_id;
+       peer->generation = generation;
+       spin_unlock_irq(&peer->dev->lock);
+}
+
 static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev)
 {
        struct fwnet_partial_datagram *pd, *pd_next;
@@ -1542,9 +1548,9 @@ static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev)
        kfree(peer);
 }
 
-static int fwnet_remove(struct device *_dev)
+static void fwnet_remove(struct fw_unit *unit)
 {
-       struct fwnet_peer *peer = dev_get_drvdata(_dev);
+       struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
        struct fwnet_device *dev = peer->dev;
        struct net_device *net;
        int i;
@@ -1569,26 +1575,6 @@ static int fwnet_remove(struct device *_dev)
        }
 
        mutex_unlock(&fwnet_device_mutex);
-
-       return 0;
-}
-
-/*
- * FIXME abort partially sent fragmented datagrams,
- * discard partially received fragmented datagrams
- */
-static void fwnet_update(struct fw_unit *unit)
-{
-       struct fw_device *device = fw_parent_device(unit);
-       struct fwnet_peer *peer = dev_get_drvdata(&unit->device);
-       int generation;
-
-       generation = device->generation;
-
-       spin_lock_irq(&peer->dev->lock);
-       peer->node_id    = device->node_id;
-       peer->generation = generation;
-       spin_unlock_irq(&peer->dev->lock);
 }
 
 static const struct ieee1394_device_id fwnet_id_table[] = {
@@ -1614,10 +1600,10 @@ static struct fw_driver fwnet_driver = {
                .owner  = THIS_MODULE,
                .name   = KBUILD_MODNAME,
                .bus    = &fw_bus_type,
-               .probe  = fwnet_probe,
-               .remove = fwnet_remove,
        },
+       .probe    = fwnet_probe,
        .update   = fwnet_update,
+       .remove   = fwnet_remove,
        .id_table = fwnet_id_table,
 };