Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=acc5efbcd2a023c8801f2bba39971cf93812ce7c
Commit:     acc5efbcd2a023c8801f2bba39971cf93812ce7c
Parent:     69ab4b7d6db68396dbfa827daa8d6f30f9b546a8
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 21 00:25:31 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:08:30 2008 -0800

    [VLAN]: Clean up unregister_vlan_dev
    
    Save two levels of indentation by aborting on error conditions,
    remove unnecessary initialization to NULL and remove two obvious
    comments.
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/8021q/vlan.c |   72 ++++++++++++++++++++++++------------------------------
 1 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 006d9a9..ad34e4a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -142,63 +142,55 @@ static void vlan_rcu_free(struct rcu_head *rcu)
 static int unregister_vlan_dev(struct net_device *real_dev,
                               unsigned short vlan_id)
 {
-       struct net_device *dev = NULL;
+       struct net_device *dev;
        int real_dev_ifindex = real_dev->ifindex;
        struct vlan_group *grp;
-       int i, ret;
+       unsigned int i;
+       int ret;
 
-       /* sanity check */
        if (vlan_id >= VLAN_VID_MASK)
                return -EINVAL;
 
        ASSERT_RTNL();
        grp = __vlan_find_group(real_dev_ifindex);
+       if (!grp)
+               return -ENOENT;
 
-       ret = 0;
-
-       if (grp) {
-               dev = vlan_group_get_device(grp, vlan_id);
-               if (dev) {
-                       /* Remove proc entry */
-                       vlan_proc_rem_dev(dev);
-
-                       /* Take it out of our own structures, but be sure to
-                        * interlock with HW accelerating devices or SW vlan
-                        * input packet processing.
-                        */
-                       if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
-                               real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
+       dev = vlan_group_get_device(grp, vlan_id);
+       if (!dev)
+               return -ENOENT;
 
-                       vlan_group_set_device(grp, vlan_id, NULL);
-                       synchronize_net();
+       vlan_proc_rem_dev(dev);
 
+       /* Take it out of our own structures, but be sure to interlock with
+        * HW accelerating devices or SW vlan input packet processing.
+        */
+       if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
+               real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
 
-                       /* Caller unregisters (and if necessary, puts)
-                        * VLAN device, but we get rid of the reference to
-                        * real_dev here.
-                        */
-                       dev_put(real_dev);
+       vlan_group_set_device(grp, vlan_id, NULL);
+       synchronize_net();
 
-                       /* If the group is now empty, kill off the
-                        * group.
-                        */
-                       for (i = 0; i < VLAN_VID_MASK; i++)
-                               if (vlan_group_get_device(grp, i))
-                                       break;
+       /* Caller unregisters (and if necessary, puts) VLAN device, but we
+        * get rid of the reference to real_dev here.
+        */
+       dev_put(real_dev);
 
-                       if (i == VLAN_VID_MASK) {
-                               if (real_dev->features & NETIF_F_HW_VLAN_RX)
-                                       real_dev->vlan_rx_register(real_dev, 
NULL);
+       /* If the group is now empty, kill off the group. */
+       ret = 0;
+       for (i = 0; i < VLAN_VID_MASK; i++)
+               if (vlan_group_get_device(grp, i))
+                       break;
 
-                               hlist_del_rcu(&grp->hlist);
+       if (i == VLAN_VID_MASK) {
+               if (real_dev->features & NETIF_F_HW_VLAN_RX)
+                       real_dev->vlan_rx_register(real_dev, NULL);
 
-                               /* Free the group, after all cpu's are done. */
-                               call_rcu(&grp->rcu, vlan_rcu_free);
+               hlist_del_rcu(&grp->hlist);
 
-                               grp = NULL;
-                               ret = 1;
-                       }
-               }
+               /* Free the group, after all cpu's are done. */
+               call_rcu(&grp->rcu, vlan_rcu_free);
+               ret = 1;
        }
 
        return ret;
-
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