Skip to contentSkip to conversation

Remove MOD_* from LAPB

PATCH Applied Stephen Hemminger 2 participants 4 messages Jul 18, 2003 – Jul 20, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove MOD_* from LAPB

The MOD_INC and MOD_DEC in lapb are no longer necessary in 2.6 since the module subsystem will not allow lapb to be unloaded as long as a module that is referencing the symbols (lapb_register/lapb_unregister) is loaded.

The lapb parameter block does have callback's so it is up to the caller to correctly unregister on module exit; and looking at the existing code it does do that.

Patch is against 2.6-test1

net/lapb/lapb_iface.c +1 -5
diff -Nru a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
@@ -43,13 +43,11 @@
 static rwlock_t lapb_list_lock = RW_LOCK_UNLOCKED;
 
 /*
- *	Free an allocated lapb control block. This is done to centralise
- *	the MOD count code.
+ *	Free an allocated lapb control block. 
  */
 static void lapb_free_cb(struct lapb_cb *lapb)
 {
 	kfree(lapb);
-	MOD_DEC_USE_COUNT;
 }
 
 static __inline__ void lapb_hold(struct lapb_cb *lapb)
@@ -126,8 +124,6 @@
 
 	if (!lapb)
 		goto out;
-
-	MOD_INC_USE_COUNT;
 
 	memset(lapb, 0x00, sizeof(*lapb));
 
#1 lore raw

PATCH 1/1 Allow lapb to be unloaded.

Without an exit routine lapb can't be unloaded.

Tested on 2.6.0-test1

net/lapb/lapb_iface.c +6 -0
diff -Nru a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
@@ -443,8 +443,14 @@
 	return 0;
 }
 
+static void __exit lapb_exit(void)
+{
+	WARN_ON(!list_empty(&lapb_list));
+}
+
 MODULE_AUTHOR("Jonathan Naylor <[email protected]>");
 MODULE_DESCRIPTION("The X.25 Link Access Procedure B link layer protocol");
 MODULE_LICENSE("GPL");
 
 module_init(lapb_init);
+module_exit(lapb_exit);
#2 lore raw

Re: [PATCH] Allow lapb to be unloaded.

Quoted 1 line · On Fri, 18 Jul 2003 15:01:01 -0700 Stephen Hemminger <[email protected]>…

Without an exit routine lapb can't be unloaded.

Applied, thanks.

#3 lore raw
In reply to Stephen Hemminger
Quoted 7 lines · On Fri, 18 Jul 2003 13:32:11 -0700 Stephen Hemminger <[email protected]>…

The MOD_INC and MOD_DEC in lapb are no longer necessary in 2.6 since the module subsystem will not allow lapb to be unloaded as long as a module that is referencing the symbols (lapb_register/lapb_unregister) is loaded.

The lapb parameter block does have callback's so it is up to the caller to correctly unregister on module exit; and looking at the existing code it does do that.

Applied, thanks.