public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Module load notification take 3
@ 2003-03-25  2:03 John Levon
  2003-03-25  2:13 ` [PATCH 2/2] " John Levon
  2003-03-25  6:32 ` [PATCH 1/2] " Rusty Russell
  0 siblings, 2 replies; 7+ messages in thread
From: John Levon @ 2003-03-25  2:03 UTC (permalink / raw)
  To: oprofile-list, torvalds, linux-kernel, rusty


Implement a module load notifier for the benefit of OProfile, tested
with .66 on UP.

This patch (1/2) provides the general support for registering notifiers,
and calls the notifier when a module is loaded.

Please apply.

john


diff -X dontdiff -Naur linux-linus/include/linux/module.h linux-cvs/include/linux/module.h
--- linux-linus/include/linux/module.h	2003-03-25 01:38:51.000000000 +0000
+++ linux-cvs/include/linux/module.h	2003-03-25 01:34:42.000000000 +0000
@@ -138,6 +138,7 @@
 	const struct exception_table_entry *entry;
 };
 
+struct notifier_block;
 
 #ifdef CONFIG_MODULES
 
@@ -348,6 +349,9 @@
 /* For extable.c to search modules' exception tables. */
 const struct exception_table_entry *search_module_extables(unsigned long addr);
 
+int register_module_notifier(struct notifier_block * nb);
+int unregister_module_notifier(struct notifier_block * nb);
+
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym)
@@ -392,6 +396,18 @@
 {
 	return NULL;
 }
+
+static inline int register_module_notifier(struct notifier_block * nb)
+{
+	/* no events will happen anyway, so this can always succeed */
+	return 0;
+}
+
+static inline int unregister_module_notifier(struct notifier_block * nb)
+{
+	return 0;
+}
+
 #endif /* CONFIG_MODULES */
 
 #ifdef MODULE
diff -X dontdiff -Naur linux-linus/kernel/module.c linux-cvs/kernel/module.c
--- linux-linus/kernel/module.c	2003-03-17 21:44:21.000000000 +0000
+++ linux-cvs/kernel/module.c	2003-03-25 01:31:40.000000000 +0000
@@ -31,6 +31,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/vermagic.h>
+#include <linux/notifier.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <asm/pgalloc.h>
@@ -61,6 +62,29 @@
 static LIST_HEAD(symbols);
 static LIST_HEAD(extables);
 
+static DECLARE_MUTEX(notify_mutex);
+static struct notifier_block * module_notify_list;
+
+int register_module_notifier(struct notifier_block * nb)
+{
+	int err;
+	down(&notify_mutex);
+	err = notifier_chain_register(&module_notify_list, nb);
+	up(&notify_mutex);
+	return err;
+}
+EXPORT_SYMBOL(register_module_notifier);
+
+int unregister_module_notifier(struct notifier_block * nb)
+{
+	int err;
+	down(&notify_mutex);
+	err = notifier_chain_unregister(&module_notify_list, nb);
+	up(&notify_mutex);
+	return err;
+}
+EXPORT_SYMBOL(unregister_module_notifier);
+
 /* We require a truly strong try_module_get() */
 static inline int strong_try_module_get(struct module *mod)
 {
@@ -1368,6 +1392,10 @@
 	/* Drop lock so they can recurse */
 	up(&module_mutex);
 
+	down(&notify_mutex);
+	notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod);
+	up(&notify_mutex);
+
 	/* Start the module */
 	ret = mod->init();
 	if (ret < 0) {


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] Module load notification take 3
  2003-03-25  2:03 [PATCH 1/2] Module load notification take 3 John Levon
@ 2003-03-25  2:13 ` John Levon
  2003-03-25  6:32 ` [PATCH 1/2] " Rusty Russell
  1 sibling, 0 replies; 7+ messages in thread
From: John Levon @ 2003-03-25  2:13 UTC (permalink / raw)
  To: oprofile-list, torvalds, linux-kernel, rusty


Implement a module load notifier for the benefit of OProfile, tested
with .66 on UP.
 
This patch (2/2) hooks OProfile into the notifier. You should still be
able to use OProfile 0.5.1 or thereabouts ...

thanks,
john

diff -X dontdiff -Naur linux-linus/drivers/oprofile/buffer_sync.c linux-cvs/drivers/oprofile/buffer_sync.c
--- linux-linus/drivers/oprofile/buffer_sync.c	2003-03-25 01:38:46.000000000 +0000
+++ linux-cvs/drivers/oprofile/buffer_sync.c	2003-03-25 01:34:52.000000000 +0000
@@ -24,6 +24,7 @@
 #include <linux/notifier.h>
 #include <linux/dcookies.h>
 #include <linux/profile.h>
+#include <linux/module.h>
 #include <linux/fs.h>
  
 #include "oprofile_stats.h"
@@ -67,6 +68,19 @@
 }
 
  
+static int module_load_notify(struct notifier_block * self, unsigned long val, void * data)
+{
+	if (val != MODULE_STATE_COMING)
+		return 0;
+
+	sync_cpu_buffers();
+	down(&buffer_sem);
+	add_event_entry(ESCAPE_CODE);
+	add_event_entry(MODULE_LOADED_CODE);
+	up(&buffer_sem);
+	return 0;
+}
+
 static struct notifier_block exit_task_nb = {
 	.notifier_call	= exit_task_notify,
 };
@@ -79,6 +93,10 @@
 	.notifier_call	= mm_notify,
 };
  
+static struct notifier_block module_load_nb = {
+	.notifier_call = module_load_notify,
+};
+
  
 int sync_start(void)
 {
@@ -98,9 +116,14 @@
 	err = profile_event_register(EXEC_UNMAP, &exec_unmap_nb);
 	if (err)
 		goto out3;
+	err = register_module_notifier(&module_load_nb);
+	if (err)
+		goto out4;
 
 out:
 	return err;
+out4:
+	profile_event_unregister(EXEC_UNMAP, &exec_unmap_nb);
 out3:
 	profile_event_unregister(EXIT_MMAP, &exit_mmap_nb);
 out2:
@@ -113,6 +136,7 @@
 
 void sync_stop(void)
 {
+	unregister_module_notifier(&module_load_nb);
 	profile_event_unregister(EXIT_TASK, &exit_task_nb);
 	profile_event_unregister(EXIT_MMAP, &exit_mmap_nb);
 	profile_event_unregister(EXEC_UNMAP, &exec_unmap_nb);
diff -X dontdiff -Naur linux-linus/drivers/oprofile/event_buffer.h linux-cvs/drivers/oprofile/event_buffer.h
--- linux-linus/drivers/oprofile/event_buffer.h	2003-03-17 21:43:41.000000000 +0000
+++ linux-cvs/drivers/oprofile/event_buffer.h	2003-03-25 01:31:43.000000000 +0000
@@ -24,12 +24,13 @@
  * then one of the following codes, then the
  * relevant data.
  */
-#define ESCAPE_CODE		~0UL
+#define ESCAPE_CODE			~0UL
 #define CTX_SWITCH_CODE 		1
 #define CPU_SWITCH_CODE 		2
 #define COOKIE_SWITCH_CODE 		3
 #define KERNEL_ENTER_SWITCH_CODE	4
 #define KERNEL_EXIT_SWITCH_CODE		5
+#define MODULE_LOADED_CODE		6
  
 /* add data to the event buffer */
 void add_event_entry(unsigned long data);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Module load notification take 3
  2003-03-25  2:03 [PATCH 1/2] Module load notification take 3 John Levon
  2003-03-25  2:13 ` [PATCH 2/2] " John Levon
@ 2003-03-25  6:32 ` Rusty Russell
  2003-03-25 11:41   ` John Levon
  1 sibling, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2003-03-25  6:32 UTC (permalink / raw)
  To: John Levon; +Cc: oprofile-list, torvalds, linux-kernel

In message <20030325020316.GA95492@compsoc.man.ac.uk> you write:
> 
> Implement a module load notifier for the benefit of OProfile, tested
> with .66 on UP.

Minor change to make unregister_module_notifier return void.

Either way Linus, don't really mind.  Please apply.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Module Notifier Patch
Author: John Levon
Status: Experimental

D: Adds a notifier for when modules are inserted, for use of oprofile.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17066-linux-2.5.66/include/linux/module.h .17066-linux-2.5.66.updated/include/linux/module.h
--- .17066-linux-2.5.66/include/linux/module.h	2003-03-25 12:17:31.000000000 +1100
+++ .17066-linux-2.5.66.updated/include/linux/module.h	2003-03-25 17:31:06.000000000 +1100
@@ -138,6 +138,7 @@ struct exception_table
 	const struct exception_table_entry *entry;
 };
 
+struct notifier_block;
 
 #ifdef CONFIG_MODULES
 
@@ -348,6 +349,9 @@ const char *module_address_lookup(unsign
 /* For extable.c to search modules' exception tables. */
 const struct exception_table_entry *search_module_extables(unsigned long addr);
 
+int register_module_notifier(struct notifier_block *nb);
+void unregister_module_notifier(struct notifier_block *nb);
+
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym)
@@ -392,6 +396,17 @@ static inline const char *module_address
 {
 	return NULL;
 }
+
+static inline int register_module_notifier(struct notifier_block *nb)
+{
+	/* no events will happen anyway, so this can always succeed */
+	return 0;
+}
+
+static inline void unregister_module_notifier(struct notifier_block *nb)
+{
+}
+
 #endif /* CONFIG_MODULES */
 
 #ifdef MODULE
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17066-linux-2.5.66/kernel/module.c .17066-linux-2.5.66.updated/kernel/module.c
--- .17066-linux-2.5.66/kernel/module.c	2003-03-18 05:01:52.000000000 +1100
+++ .17066-linux-2.5.66.updated/kernel/module.c	2003-03-25 17:31:06.000000000 +1100
@@ -31,6 +31,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/vermagic.h>
+#include <linux/notifier.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <asm/pgalloc.h>
@@ -61,6 +62,27 @@ static LIST_HEAD(modules);
 static LIST_HEAD(symbols);
 static LIST_HEAD(extables);
 
+static DECLARE_MUTEX(notify_mutex);
+static struct notifier_block *module_notify_list;
+
+int register_module_notifier(struct notifier_block * nb)
+{
+	int err;
+	down(&notify_mutex);
+	err = notifier_chain_register(&module_notify_list, nb);
+	up(&notify_mutex);
+	return err;
+}
+EXPORT_SYMBOL(register_module_notifier);
+
+void unregister_module_notifier(struct notifier_block * nb)
+{
+	down(&notify_mutex);
+	notifier_chain_unregister(&module_notify_list, nb);
+	up(&notify_mutex);
+}
+EXPORT_SYMBOL(unregister_module_notifier);
+
 /* We require a truly strong try_module_get() */
 static inline int strong_try_module_get(struct module *mod)
 {
@@ -1368,6 +1390,10 @@ sys_init_module(void *umod,
 	/* Drop lock so they can recurse */
 	up(&module_mutex);
 
+	down(&notify_mutex);
+	notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod);
+	up(&notify_mutex);
+
 	/* Start the module */
 	ret = mod->init();
 	if (ret < 0) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Module load notification take 3
  2003-03-25  6:32 ` [PATCH 1/2] " Rusty Russell
@ 2003-03-25 11:41   ` John Levon
  2003-03-27  2:20     ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: John Levon @ 2003-03-25 11:41 UTC (permalink / raw)
  To: Rusty Russell; +Cc: oprofile-list, torvalds, linux-kernel

On Tue, Mar 25, 2003 at 05:32:33PM +1100, Rusty Russell wrote:

> > Implement a module load notifier for the benefit of OProfile, tested
> > with .66 on UP.
> 
> Minor change to make unregister_module_notifier return void.

The -ENOENT return is there for a reason. If you don't want it, then you
should remove it from notifier_call_register too.

john

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Module load notification take 3
  2003-03-25 11:41   ` John Levon
@ 2003-03-27  2:20     ` Rusty Russell
  2003-03-27  4:17       ` John Levon
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2003-03-27  2:20 UTC (permalink / raw)
  To: John Levon; +Cc: oprofile-list, torvalds, linux-kernel

In message <20030325114152.GB30581@compsoc.man.ac.uk> you write:
> On Tue, Mar 25, 2003 at 05:32:33PM +1100, Rusty Russell wrote:
> 
> > > Implement a module load notifier for the benefit of OProfile, tested
> > > with .66 on UP.
> > 
> > Minor change to make unregister_module_notifier return void.
> 
> The -ENOENT return is there for a reason.

What reason?  I just grepped 2.5.66-bk2, and *noone* uses the return
value, not even to BUG() (you have to grep for all the wrappers for
notifier_call_unregister, too).

That's because everyone realizes that the return value is useless.

> If you don't want it, then you should remove it from
> notifier_call_register too.

(I assume you mean notifier_call_unregister).  Yes, but that's another
battle.

Meanwhile, at least I'm not adding to the problem.
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Module load notification take 3
  2003-03-27  2:20     ` Rusty Russell
@ 2003-03-27  4:17       ` John Levon
  2003-03-27  5:26         ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: John Levon @ 2003-03-27  4:17 UTC (permalink / raw)
  To: Rusty Russell; +Cc: oprofile-list, torvalds, linux-kernel

On Thu, Mar 27, 2003 at 01:20:23PM +1100, Rusty Russell wrote:

> What reason?  I just grepped 2.5.66-bk2, and *noone* uses the return
> value, not even to BUG() (you have to grep for all the wrappers for
> notifier_call_unregister, too).

Just more grist for the mill of the ill ...

> (I assume you mean notifier_call_unregister).  Yes, but that's another
> battle.

... and it's the same ill. Half-cleaned up stuff sucks. Either remove it
or don't.

> That's because everyone realizes that the return value is useless.

It detects one variant of unmatched register/unregister, so it cannot be
said to be entirely useless. I would not call it entirely useful,
though, I admit.

Beside the point though really, I appear to have made onto Linus'
shitlist at last ... does this mean I finally graduated Linux School ?

regards
john

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Module load notification take 3
  2003-03-27  4:17       ` John Levon
@ 2003-03-27  5:26         ` Rusty Russell
  0 siblings, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2003-03-27  5:26 UTC (permalink / raw)
  To: John Levon; +Cc: oprofile-list, torvalds, linux-kernel

In message <20030327041759.GA4367@compsoc.man.ac.uk> you write:
> On Thu, Mar 27, 2003 at 01:20:23PM +1100, Rusty Russell wrote:
> ... and it's the same ill. Half-cleaned up stuff sucks. Either remove it
> or don't.

I like that attitude: I'm not sure I have the energy to match it 8)

However, please look at patch below.

> > That's because everyone realizes that the return value is useless.
> 
> It detects one variant of unmatched register/unregister, so it cannot be
> said to be entirely useless. I would not call it entirely useful,
> though, I admit.

BUG() in the unregister makes sense I think (see patch).

> Beside the point though really, I appear to have made onto Linus'
> shitlist at last ... does this mean I finally graduated Linux School ?

Linus fades every so often.  Has more to do with phase of the moon, I
think, than individuals.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: notifier_unregister should return void
Author: Rusty Russell
Status: Tested on 2.5.66-bk2

D: Noone uses the return value of notifier_chain_unregister and its
D: children: make it BUG() when unregistering a non-existent notifier,
D: and return void.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/cpufreq.h working-2.5.66-bk2-notifier/include/linux/cpufreq.h
--- linux-2.5.66-bk2/include/linux/cpufreq.h	2003-03-18 12:21:40.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/cpufreq.h	2003-03-27 15:41:52.000000000 +1100
@@ -29,7 +29,7 @@
  *********************************************************************/
 
 int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
-int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
+void cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
 
 #define CPUFREQ_TRANSITION_NOTIFIER     (0)
 #define CPUFREQ_POLICY_NOTIFIER         (1)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/inetdevice.h working-2.5.66-bk2-notifier/include/linux/inetdevice.h
--- linux-2.5.66-bk2/include/linux/inetdevice.h	2003-01-02 12:34:08.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/inetdevice.h	2003-03-27 15:59:02.000000000 +1100
@@ -77,7 +77,7 @@ struct in_ifaddr
 };
 
 extern int register_inetaddr_notifier(struct notifier_block *nb);
-extern int unregister_inetaddr_notifier(struct notifier_block *nb);
+extern void unregister_inetaddr_notifier(struct notifier_block *nb);
 
 extern struct net_device 	*ip_dev_find(u32 addr);
 extern int		inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/netdevice.h working-2.5.66-bk2-notifier/include/linux/netdevice.h
--- linux-2.5.66-bk2/include/linux/netdevice.h	2003-03-27 12:11:45.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/netdevice.h	2003-03-27 15:41:49.000000000 +1100
@@ -487,7 +487,7 @@ extern int		dev_queue_xmit(struct sk_buf
 extern int		register_netdevice(struct net_device *dev);
 extern int		unregister_netdevice(struct net_device *dev);
 extern int 		register_netdevice_notifier(struct notifier_block *nb);
-extern int		unregister_netdevice_notifier(struct notifier_block *nb);
+extern void		unregister_netdevice_notifier(struct notifier_block *nb);
 extern int		call_netdevice_notifiers(unsigned long val, void *v);
 extern int		dev_new_index(void);
 extern struct net_device	*dev_get_by_index(int ifindex);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/netlink.h working-2.5.66-bk2-notifier/include/linux/netlink.h
--- linux-2.5.66-bk2/include/linux/netlink.h	2003-02-07 19:16:27.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/netlink.h	2003-03-27 15:42:20.000000000 +1100
@@ -114,7 +114,7 @@ extern int netlink_broadcast(struct sock
 			     __u32 group, int allocation);
 extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
 extern int netlink_register_notifier(struct notifier_block *nb);
-extern int netlink_unregister_notifier(struct notifier_block *nb);
+extern void netlink_unregister_notifier(struct notifier_block *nb);
 
 /*
  *	skb should fit one page. This choice is good for headerless malloc.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/notifier.h working-2.5.66-bk2-notifier/include/linux/notifier.h
--- linux-2.5.66-bk2/include/linux/notifier.h	2003-01-02 12:32:49.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/notifier.h	2003-03-27 15:37:31.000000000 +1100
@@ -22,7 +22,7 @@ struct notifier_block
 #ifdef __KERNEL__
 
 extern int notifier_chain_register(struct notifier_block **list, struct notifier_block *n);
-extern int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n);
+extern void notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n);
 extern int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v);
 
 #define NOTIFY_DONE		0x0000		/* Don't care */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/profile.h working-2.5.66-bk2-notifier/include/linux/profile.h
--- linux-2.5.66-bk2/include/linux/profile.h	2003-03-18 12:21:40.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/profile.h	2003-03-27 15:42:15.000000000 +1100
@@ -43,10 +43,10 @@ void profile_exit_mmap(struct mm_struct 
 
 int profile_event_register(enum profile_type, struct notifier_block * n);
 
-int profile_event_unregister(enum profile_type, struct notifier_block * n);
+void profile_event_unregister(enum profile_type, struct notifier_block * n);
 
 int register_profile_notifier(struct notifier_block * nb);
-int unregister_profile_notifier(struct notifier_block * nb);
+void unregister_profile_notifier(struct notifier_block * nb);
 
 /* profiling hook activated on each timer interrupt */
 void profile_hook(struct pt_regs * regs);
@@ -58,9 +58,8 @@ static inline int profile_event_register
 	return -ENOSYS;
 }
 
-static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n)
+static inline void profile_event_unregister(enum profile_type t, struct notifier_block * n)
 {
-	return -ENOSYS;
 }
 
 #define profile_exit_task(a) do { } while (0)
@@ -72,9 +71,8 @@ static inline int register_profile_notif
 	return -ENOSYS;
 }
 
-static inline int unregister_profile_notifier(struct notifier_block * nb)
+static inline void unregister_profile_notifier(struct notifier_block * nb)
 {
-	return -ENOSYS;
 }
 
 #define profile_hook(regs) do { } while (0)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/linux/reboot.h working-2.5.66-bk2-notifier/include/linux/reboot.h
--- linux-2.5.66-bk2/include/linux/reboot.h	2003-02-07 19:17:54.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/linux/reboot.h	2003-03-27 15:41:56.000000000 +1100
@@ -37,7 +37,7 @@
 #include <linux/notifier.h>
 
 extern int register_reboot_notifier(struct notifier_block *);
-extern int unregister_reboot_notifier(struct notifier_block *);
+extern void unregister_reboot_notifier(struct notifier_block *);
 
 
 /*
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/net/addrconf.h working-2.5.66-bk2-notifier/include/net/addrconf.h
--- linux-2.5.66-bk2/include/net/addrconf.h	2003-03-25 12:17:31.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/net/addrconf.h	2003-03-27 15:42:38.000000000 +1100
@@ -123,7 +123,7 @@ extern int			ipv6_chk_acast_addr(struct 
 
 /* Device notifier */
 extern int register_inet6addr_notifier(struct notifier_block *nb);
-extern int unregister_inet6addr_notifier(struct notifier_block *nb);
+extern void unregister_inet6addr_notifier(struct notifier_block *nb);
 
 static inline struct inet6_dev *
 __in6_dev_get(struct net_device *dev)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/include/net/bluetooth/hci_core.h working-2.5.66-bk2-notifier/include/net/bluetooth/hci_core.h
--- linux-2.5.66-bk2/include/net/bluetooth/hci_core.h	2003-02-25 10:11:10.000000000 +1100
+++ working-2.5.66-bk2-notifier/include/net/bluetooth/hci_core.h	2003-03-27 15:42:35.000000000 +1100
@@ -467,7 +467,7 @@ static inline void hci_proto_encrypt_cfm
 int hci_register_proto(struct hci_proto *hproto);
 int hci_unregister_proto(struct hci_proto *hproto);
 int hci_register_notifier(struct notifier_block *nb);
-int hci_unregister_notifier(struct notifier_block *nb);
+void hci_unregister_notifier(struct notifier_block *nb);
 
 int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *param);
 int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/kernel/cpufreq.c working-2.5.66-bk2-notifier/kernel/cpufreq.c
--- linux-2.5.66-bk2/kernel/cpufreq.c	2003-03-25 12:17:31.000000000 +1100
+++ working-2.5.66-bk2-notifier/kernel/cpufreq.c	2003-03-27 15:43:36.000000000 +1100
@@ -484,27 +484,22 @@ EXPORT_SYMBOL(cpufreq_register_notifier)
  *
  *	Remove a driver from the CPU frequency notifier list.
  *
- *	This function may sleep, and has the same return conditions as
- *	notifier_chain_unregister.
+ *	This function may sleep.
  */
-int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
+void cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
 {
-	int ret;
-
 	down_write(&cpufreq_notifier_rwsem);
 	switch (list) {
 	case CPUFREQ_TRANSITION_NOTIFIER:
-		ret = notifier_chain_unregister(&cpufreq_transition_notifier_list, nb);
+		notifier_chain_unregister(&cpufreq_transition_notifier_list, nb);
 		break;
 	case CPUFREQ_POLICY_NOTIFIER:
-		ret = notifier_chain_unregister(&cpufreq_policy_notifier_list, nb);
+		notifier_chain_unregister(&cpufreq_policy_notifier_list, nb);
 		break;
 	default:
-		ret = -EINVAL;
+		BUG();
 	}
 	up_write(&cpufreq_notifier_rwsem);
-
-	return ret;
 }
 EXPORT_SYMBOL(cpufreq_unregister_notifier);
 
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/kernel/profile.c working-2.5.66-bk2-notifier/kernel/profile.c
--- linux-2.5.66-bk2/kernel/profile.c	2003-02-25 10:11:11.000000000 +1100
+++ working-2.5.66-bk2-notifier/kernel/profile.c	2003-03-27 15:44:06.000000000 +1100
@@ -97,26 +97,23 @@ int profile_event_register(enum profile_
 }
 
  
-int profile_event_unregister(enum profile_type type, struct notifier_block * n)
+void profile_event_unregister(enum profile_type type, struct notifier_block * n)
 {
-	int err = -EINVAL;
- 
 	down_write(&profile_rwsem);
  
 	switch (type) {
 		case EXIT_TASK:
-			err = notifier_chain_unregister(&exit_task_notifier, n);
+			notifier_chain_unregister(&exit_task_notifier, n);
 			break;
 		case EXIT_MMAP:
-			err = notifier_chain_unregister(&exit_mmap_notifier, n);
+			notifier_chain_unregister(&exit_mmap_notifier, n);
 			break;
 		case EXEC_UNMAP:
-			err = notifier_chain_unregister(&exec_unmap_notifier, n);
+			notifier_chain_unregister(&exec_unmap_notifier, n);
 			break;
 	}
 
 	up_write(&profile_rwsem);
-	return err;
 }
 
 static struct notifier_block * profile_listeners;
@@ -132,13 +129,11 @@ int register_profile_notifier(struct not
 }
 
 
-int unregister_profile_notifier(struct notifier_block * nb)
+void unregister_profile_notifier(struct notifier_block * nb)
 {
-	int err;
 	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
+	notifier_chain_unregister(&profile_listeners, nb);
 	write_unlock_irq(&profile_lock);
-	return err;
 }
 
 
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/kernel/sys.c working-2.5.66-bk2-notifier/kernel/sys.c
--- linux-2.5.66-bk2/kernel/sys.c	2003-03-25 12:17:32.000000000 +1100
+++ working-2.5.66-bk2-notifier/kernel/sys.c	2003-03-27 16:07:33.000000000 +1100
@@ -111,11 +111,9 @@ int notifier_chain_register(struct notif
  *	@n: New entry in notifier chain
  *
  *	Removes a notifier from a notifier chain.
- *
- *	Returns zero on success, or %-ENOENT on failure.
  */
  
-int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n)
+void notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n)
 {
 	write_lock(&notifier_lock);
 	while((*nl)!=NULL)
@@ -124,12 +122,12 @@ int notifier_chain_unregister(struct not
 		{
 			*nl=n->next;
 			write_unlock(&notifier_lock);
-			return 0;
+			return;
 		}
 		nl=&((*nl)->next);
 	}
 	write_unlock(&notifier_lock);
-	return -ENOENT;
+	BUG();
 }
 
 /**
@@ -187,13 +185,11 @@ int register_reboot_notifier(struct noti
  *
  *	Unregisters a previously registered reboot
  *	notifier function.
- *
- *	Returns zero on success, or %-ENOENT on failure.
  */
  
-int unregister_reboot_notifier(struct notifier_block * nb)
+void unregister_reboot_notifier(struct notifier_block * nb)
 {
-	return notifier_chain_unregister(&reboot_notifier_list, nb);
+	notifier_chain_unregister(&reboot_notifier_list, nb);
 }
 
 asmlinkage long sys_ni_syscall(void)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/net/bluetooth/hci_core.c working-2.5.66-bk2-notifier/net/bluetooth/hci_core.c
--- linux-2.5.66-bk2/net/bluetooth/hci_core.c	2003-02-25 10:11:12.000000000 +1100
+++ working-2.5.66-bk2-notifier/net/bluetooth/hci_core.c	2003-03-27 15:44:54.000000000 +1100
@@ -83,9 +83,9 @@ int hci_register_notifier(struct notifie
 	return notifier_chain_register(&hci_notifier, nb);
 }
 
-int hci_unregister_notifier(struct notifier_block *nb)
+void hci_unregister_notifier(struct notifier_block *nb)
 {
-	return notifier_chain_unregister(&hci_notifier, nb);
+	notifier_chain_unregister(&hci_notifier, nb);
 }
 
 void hci_notify(struct hci_dev *hdev, int event)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/net/core/dev.c working-2.5.66-bk2-notifier/net/core/dev.c
--- linux-2.5.66-bk2/net/core/dev.c	2003-03-25 12:17:32.000000000 +1100
+++ working-2.5.66-bk2-notifier/net/core/dev.c	2003-03-27 15:45:14.000000000 +1100
@@ -912,13 +912,12 @@ int register_netdevice_notifier(struct n
  *
  *	Unregister a notifier previously registered by
  *	register_netdevice_notifier(). The notifier is unlinked into the
- *	kernel structures and may then be reused. A negative errno code
- *	is returned on a failure.
+ *	kernel structures and may then be reused.
  */
 
-int unregister_netdevice_notifier(struct notifier_block *nb)
+void unregister_netdevice_notifier(struct notifier_block *nb)
 {
-	return notifier_chain_unregister(&netdev_chain, nb);
+	notifier_chain_unregister(&netdev_chain, nb);
 }
 
 /**
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/net/ipv4/devinet.c working-2.5.66-bk2-notifier/net/ipv4/devinet.c
--- linux-2.5.66-bk2/net/ipv4/devinet.c	2003-02-11 14:26:21.000000000 +1100
+++ working-2.5.66-bk2-notifier/net/ipv4/devinet.c	2003-03-27 15:45:31.000000000 +1100
@@ -818,9 +818,9 @@ int register_inetaddr_notifier(struct no
 	return notifier_chain_register(&inetaddr_chain, nb);
 }
 
-int unregister_inetaddr_notifier(struct notifier_block *nb)
+void unregister_inetaddr_notifier(struct notifier_block *nb)
 {
-	return notifier_chain_unregister(&inetaddr_chain, nb);
+	notifier_chain_unregister(&inetaddr_chain, nb);
 }
 
 /* Rename ifa_labels for a device name change. Make some effort to preserve existing
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/net/ipv6/addrconf.c working-2.5.66-bk2-notifier/net/ipv6/addrconf.c
--- linux-2.5.66-bk2/net/ipv6/addrconf.c	2003-03-25 12:17:33.000000000 +1100
+++ working-2.5.66-bk2-notifier/net/ipv6/addrconf.c	2003-03-27 15:45:42.000000000 +1100
@@ -2636,9 +2636,9 @@ int register_inet6addr_notifier(struct n
         return notifier_chain_register(&inet6addr_chain, nb);
 }
 
-int unregister_inet6addr_notifier(struct notifier_block *nb)
+void unregister_inet6addr_notifier(struct notifier_block *nb)
 {
-        return notifier_chain_unregister(&inet6addr_chain,nb);
+	notifier_chain_unregister(&inet6addr_chain,nb);
 }
 
 /*
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/net/netlink/af_netlink.c working-2.5.66-bk2-notifier/net/netlink/af_netlink.c
--- linux-2.5.66-bk2/net/netlink/af_netlink.c	2003-03-18 12:21:41.000000000 +1100
+++ working-2.5.66-bk2-notifier/net/netlink/af_netlink.c	2003-03-27 15:45:53.000000000 +1100
@@ -1023,9 +1023,9 @@ int netlink_register_notifier(struct not
 	return notifier_chain_register(&netlink_chain, nb);
 }
 
-int netlink_unregister_notifier(struct notifier_block *nb)
+void netlink_unregister_notifier(struct notifier_block *nb)
 {
-	return notifier_chain_unregister(&netlink_chain, nb);
+	notifier_chain_unregister(&netlink_chain, nb);
 }
                 
 struct proto_ops netlink_ops = {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-03-27  6:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-25  2:03 [PATCH 1/2] Module load notification take 3 John Levon
2003-03-25  2:13 ` [PATCH 2/2] " John Levon
2003-03-25  6:32 ` [PATCH 1/2] " Rusty Russell
2003-03-25 11:41   ` John Levon
2003-03-27  2:20     ` Rusty Russell
2003-03-27  4:17       ` John Levon
2003-03-27  5:26         ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox