Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d06c1ddad9055eef55456abbae795279d6b1bbcf
Commit:     d06c1ddad9055eef55456abbae795279d6b1bbcf
Parent:     5e7abccd38f7f2ce838eb49a657eea70b22f0803
Author:     Stefan Richter <[EMAIL PROTECTED]>
AuthorDate: Mon Apr 2 02:14:45 2007 +0200
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Mon Apr 30 00:00:31 2007 +0200

    ieee1394: eth1394: refactor .probe and .update
    
    Move common code into an extra function.  This implicitly adds a missing
    node_info->fifo = CSR1212_INVALID_ADDR_SPACE; to .update.
    
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
---
 drivers/ieee1394/eth1394.c |   48 ++++++++++++++-----------------------------
 1 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index e1fdfb5..66c4cca 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -340,20 +340,13 @@ static struct eth1394_node_ref 
*eth1394_find_node_nodeid(struct list_head *inl,
        return NULL;
 }
 
-static int eth1394_probe(struct device *dev)
+static int eth1394_new_node(struct eth1394_host_info *hi,
+                           struct unit_directory *ud)
 {
-       struct unit_directory *ud;
-       struct eth1394_host_info *hi;
        struct eth1394_priv *priv;
        struct eth1394_node_ref *new_node;
        struct eth1394_node_info *node_info;
 
-       ud = container_of(dev, struct unit_directory, device);
-
-       hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
-       if (!hi)
-               return -ENOENT;
-
        new_node = kmalloc(sizeof(*new_node), GFP_KERNEL);
        if (!new_node)
                return -ENOMEM;
@@ -374,10 +367,22 @@ static int eth1394_probe(struct device *dev)
 
        priv = netdev_priv(hi->dev);
        list_add_tail(&new_node->list, &priv->ip_node_list);
-
        return 0;
 }
 
+static int eth1394_probe(struct device *dev)
+{
+       struct unit_directory *ud;
+       struct eth1394_host_info *hi;
+
+       ud = container_of(dev, struct unit_directory, device);
+       hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
+       if (!hi)
+               return -ENOENT;
+
+       return eth1394_new_node(hi, ud);
+}
+
 static int eth1394_remove(struct device *dev)
 {
        struct unit_directory *ud;
@@ -421,38 +426,17 @@ static int eth1394_update(struct unit_directory *ud)
        struct eth1394_host_info *hi;
        struct eth1394_priv *priv;
        struct eth1394_node_ref *node;
-       struct eth1394_node_info *node_info;
 
        hi = hpsb_get_hostinfo(&eth1394_highlevel, ud->ne->host);
        if (!hi)
                return -ENOENT;
 
        priv = netdev_priv(hi->dev);
-
        node = eth1394_find_node(&priv->ip_node_list, ud);
        if (node)
                return 0;
 
-       node = kmalloc(sizeof(*node), GFP_KERNEL);
-       if (!node)
-               return -ENOMEM;
-
-       node_info = kmalloc(sizeof(*node_info), GFP_KERNEL);
-       if (!node_info) {
-               kfree(node);
-               return -ENOMEM;
-       }
-
-       spin_lock_init(&node_info->pdg.lock);
-       INIT_LIST_HEAD(&node_info->pdg.list);
-       node_info->pdg.sz = 0;
-
-       ud->device.driver_data = node_info;
-       node->ud = ud;
-
-       priv = netdev_priv(hi->dev);
-       list_add_tail(&node->list, &priv->ip_node_list);
-       return 0;
+       return eth1394_new_node(hi, ud);
 }
 
 static struct ieee1394_device_id eth1394_id_table[] = {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to