Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[pandora-kernel.git] / drivers / staging / batman-adv / main.c
index c1e57aa..74c70d5 100644 (file)
@@ -42,6 +42,9 @@ DEFINE_SPINLOCK(forw_bat_list_lock);
 DEFINE_SPINLOCK(forw_bcast_list_lock);
 
 atomic_t vis_interval;
+atomic_t bcast_queue_left;
+atomic_t batman_queue_left;
+
 int16_t num_hna;
 
 struct net_device *soft_device;
@@ -79,6 +82,8 @@ int init_module(void)
 
        atomic_set(&vis_interval, 1000);/* TODO: raise this later, this is only
                                         * for debugging now. */
+       atomic_set(&bcast_queue_left, BCAST_QUEUE_LEN);
+       atomic_set(&batman_queue_left, BATMAN_QUEUE_LEN);
 
        /* the name should not be longer than 10 chars - see
         * http://lwn.net/Articles/23634/ */
@@ -94,14 +99,16 @@ int init_module(void)
                                   interface_setup);
 
        if (!soft_device) {
-               printk(KERN_ERR "batman-adv:Unable to allocate the batman interface\n");
+               printk(KERN_ERR "batman-adv:"
+                      "Unable to allocate the batman interface\n");
                goto end;
        }
 
        retval = register_netdev(soft_device);
 
        if (retval < 0) {
-               printk(KERN_ERR "batman-adv:Unable to register the batman interface: %i\n", retval);
+               printk(KERN_ERR "batman-adv:"
+                      "Unable to register the batman interface: %i\n", retval);
                goto free_soft_device;
        }
 
@@ -113,13 +120,17 @@ int init_module(void)
        register_netdevice_notifier(&hard_if_notifier);
        dev_add_pack(&batman_adv_packet_type);
 
-       printk(KERN_INFO "batman-adv:B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded\n",
-                 SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION);
+       printk(KERN_INFO "batman-adv:"
+              "B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded\n",
+              SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION);
 
        return 0;
 
 unreg_soft_device:
-       unregister_netdevice(soft_device);
+       unregister_netdev(soft_device);
+       soft_device = NULL;
+       return -ENOMEM;
+
 free_soft_device:
        free_netdev(soft_device);
        soft_device = NULL;
@@ -171,7 +182,9 @@ void activate_module(void)
        goto end;
 
 err:
-       printk(KERN_ERR "batman-adv:Unable to allocate memory for mesh information structures: out of mem ?\n");
+       printk(KERN_ERR "batman-adv:"
+              "Unable to allocate memory for mesh information structures: "
+              "out of mem ?\n");
        deactivate_module();
 end:
        return;
@@ -213,7 +226,7 @@ void dec_module_count(void)
 
 int addr_to_string(char *buff, uint8_t *addr)
 {
-       return sprintf(buff, "%02x:%02x:%02x:%02x:%02x:%02x",
+       return sprintf(buff, MAC_FMT,
                       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
 }