netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] notifiers: split notifier.h into subsystem headers
@ 2011-06-22  6:35 Amerigo Wang
  2011-06-22  6:35 ` [PATCH 1/5] cpu: move cpu notifiers into cpu.h Amerigo Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, netdev, WANG Cong

Now we define all kinds of notifiers in notifier.h, this is not
necessary at all, since different subsystems use different
notifiers, they are almost non-related with each other.

This can also save much build time. Suppose I add a new netdevice
event, really I don't have to recompile all the source, just network
related. Without this patch, all the source will be recompiled.

I move the notify events near to their subsystem notifier registers,
so that they can be found more easily.

In case of conflicts, I hope Andrew Morton would take the whole
patchset, rather than different subsystem maintainers take their own.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
 drivers/mmc/core/core.c   |    3 ++
 include/linux/cpu.h       |   33 ++++++++++++++++++
 include/linux/netdevice.h |   36 ++++++++++++++++++--
 include/linux/notifier.h  |   82 +++-----------------------------------------
 include/linux/reboot.h    |    5 +++
 include/linux/suspend.h   |    8 ++++
 include/linux/vt.h        |    7 ++++
 kernel/notifier.c         |   31 -----------------
 kernel/sys.c              |   32 +++++++++++++++++-
 net/rds/page.c            |    1 +
 10 files changed, 127 insertions(+), 111 deletions(-)

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

* [PATCH 1/5] cpu: move cpu notifiers into cpu.h
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
@ 2011-06-22  6:35 ` Amerigo Wang
  2011-06-22  6:35 ` [PATCH 2/5] net: move netdevice notifiers into netdevice.h Amerigo Wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, netdev, Amerigo Wang, Andy Grover, David S. Miller,
	Tejun Heo, Greg Kroah-Hartman, Brandon Philips, Lucas De Marchi,
	Paul E. McKenney, Josh Triplett, rds-devel

It is not necessary to share the same notifier.h.

Signed-off-by: WANG Cong <amwang@redhat.com>
---
 include/linux/cpu.h      |   33 +++++++++++++++++++++++++++++++++
 include/linux/notifier.h |   34 ++--------------------------------
 net/rds/page.c           |    1 +
 3 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5f09323..b1a635a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -70,6 +70,39 @@ enum {
 	CPU_PRI_WORKQUEUE	= 5,
 };
 
+#define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */
+#define CPU_UP_PREPARE		0x0003 /* CPU (unsigned)v coming up */
+#define CPU_UP_CANCELED		0x0004 /* CPU (unsigned)v NOT coming up */
+#define CPU_DOWN_PREPARE	0x0005 /* CPU (unsigned)v going down */
+#define CPU_DOWN_FAILED		0x0006 /* CPU (unsigned)v NOT going down */
+#define CPU_DEAD		0x0007 /* CPU (unsigned)v dead */
+#define CPU_DYING		0x0008 /* CPU (unsigned)v not running any task,
+					* not handling interrupts, soon dead.
+					* Called on the dying cpu, interrupts
+					* are already disabled. Must not
+					* sleep, must not fail */
+#define CPU_POST_DEAD		0x0009 /* CPU (unsigned)v dead, cpu_hotplug
+					* lock is dropped */
+#define CPU_STARTING		0x000A /* CPU (unsigned)v soon running.
+					* Called on the new cpu, just before
+					* enabling interrupts. Must not sleep,
+					* must not fail */
+
+/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
+ * operation in progress
+ */
+#define CPU_TASKS_FROZEN	0x0010
+
+#define CPU_ONLINE_FROZEN	(CPU_ONLINE | CPU_TASKS_FROZEN)
+#define CPU_UP_PREPARE_FROZEN	(CPU_UP_PREPARE | CPU_TASKS_FROZEN)
+#define CPU_UP_CANCELED_FROZEN	(CPU_UP_CANCELED | CPU_TASKS_FROZEN)
+#define CPU_DOWN_PREPARE_FROZEN	(CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
+#define CPU_DOWN_FAILED_FROZEN	(CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
+#define CPU_DEAD_FROZEN		(CPU_DEAD | CPU_TASKS_FROZEN)
+#define CPU_DYING_FROZEN	(CPU_DYING | CPU_TASKS_FROZEN)
+#define CPU_STARTING_FROZEN	(CPU_STARTING | CPU_TASKS_FROZEN)
+
+
 #ifdef CONFIG_SMP
 /* Need to know about CPUs going up/down? */
 #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index c0688b0..9eb25fc 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -185,6 +185,8 @@ static inline int notifier_to_errno(int ret)
  *	VC switch chains (for loadable kernel svgalib VC switch helpers) etc...
  */
  
+/* CPU notfiers are defined in include/linux/cpu.h. */
+
 /* netdevice notifier chain. Please remember to update the rtnetlink
  * notification exclusion list in rtnetlink_event() when adding new
  * types.
@@ -220,38 +222,6 @@ static inline int notifier_to_errno(int ret)
 
 #define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
-#define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */
-#define CPU_UP_PREPARE		0x0003 /* CPU (unsigned)v coming up */
-#define CPU_UP_CANCELED		0x0004 /* CPU (unsigned)v NOT coming up */
-#define CPU_DOWN_PREPARE	0x0005 /* CPU (unsigned)v going down */
-#define CPU_DOWN_FAILED		0x0006 /* CPU (unsigned)v NOT going down */
-#define CPU_DEAD		0x0007 /* CPU (unsigned)v dead */
-#define CPU_DYING		0x0008 /* CPU (unsigned)v not running any task,
-					* not handling interrupts, soon dead.
-					* Called on the dying cpu, interrupts
-					* are already disabled. Must not
-					* sleep, must not fail */
-#define CPU_POST_DEAD		0x0009 /* CPU (unsigned)v dead, cpu_hotplug
-					* lock is dropped */
-#define CPU_STARTING		0x000A /* CPU (unsigned)v soon running.
-					* Called on the new cpu, just before
-					* enabling interrupts. Must not sleep,
-					* must not fail */
-
-/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
- * operation in progress
- */
-#define CPU_TASKS_FROZEN	0x0010
-
-#define CPU_ONLINE_FROZEN	(CPU_ONLINE | CPU_TASKS_FROZEN)
-#define CPU_UP_PREPARE_FROZEN	(CPU_UP_PREPARE | CPU_TASKS_FROZEN)
-#define CPU_UP_CANCELED_FROZEN	(CPU_UP_CANCELED | CPU_TASKS_FROZEN)
-#define CPU_DOWN_PREPARE_FROZEN	(CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
-#define CPU_DOWN_FAILED_FROZEN	(CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
-#define CPU_DEAD_FROZEN		(CPU_DEAD | CPU_TASKS_FROZEN)
-#define CPU_DYING_FROZEN	(CPU_DYING | CPU_TASKS_FROZEN)
-#define CPU_STARTING_FROZEN	(CPU_STARTING | CPU_TASKS_FROZEN)
-
 /* Hibernation and suspend events */
 #define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
 #define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
diff --git a/net/rds/page.c b/net/rds/page.c
index d8acdeb..b82d63e 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -32,6 +32,7 @@
  */
 #include <linux/highmem.h>
 #include <linux/gfp.h>
+#include <linux/cpu.h>
 
 #include "rds.h"
 
-- 
1.7.4.4

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

* [PATCH 2/5] net: move netdevice notifiers into netdevice.h
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
  2011-06-22  6:35 ` [PATCH 1/5] cpu: move cpu notifiers into cpu.h Amerigo Wang
@ 2011-06-22  6:35 ` Amerigo Wang
  2011-06-22  6:35 ` [PATCH 3/5] sys: move reboot notifiers into reboot.h Amerigo Wang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, netdev, Amerigo Wang, David S. Miller, Lucas De Marchi,
	Paul E. McKenney, Josh Triplett

It is not necessary to share the same notifier.h.

Signed-off-by: WANG Cong <amwang@redhat.com>
---
 include/linux/netdevice.h |   36 +++++++++++++++++++++++++++++++++---
 include/linux/notifier.h  |   28 +---------------------------
 2 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 54b8b4d..7c2026b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1566,6 +1566,39 @@ struct packet_type {
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
 
+/* netdevice notifier chain. Please remember to update the rtnetlink
+ * notification exclusion list in rtnetlink_event() when adding new
+ * types.
+ */
+#define NETDEV_UP	0x0001	/* For now you can't veto a device up/down */
+#define NETDEV_DOWN	0x0002
+#define NETDEV_REBOOT	0x0003	/* Tell a protocol stack a network interface
+				   detected a hardware crash and restarted
+				   - we can use this eg to kick tcp sessions
+				   once done */
+#define NETDEV_CHANGE	0x0004	/* Notify device state change */
+#define NETDEV_REGISTER 0x0005
+#define NETDEV_UNREGISTER	0x0006
+#define NETDEV_CHANGEMTU	0x0007
+#define NETDEV_CHANGEADDR	0x0008
+#define NETDEV_GOING_DOWN	0x0009
+#define NETDEV_CHANGENAME	0x000A
+#define NETDEV_FEAT_CHANGE	0x000B
+#define NETDEV_BONDING_FAILOVER 0x000C
+#define NETDEV_PRE_UP		0x000D
+#define NETDEV_PRE_TYPE_CHANGE	0x000E
+#define NETDEV_POST_TYPE_CHANGE	0x000F
+#define NETDEV_POST_INIT	0x0010
+#define NETDEV_UNREGISTER_BATCH 0x0011
+#define NETDEV_RELEASE		0x0012
+#define NETDEV_NOTIFY_PEERS	0x0013
+#define NETDEV_JOIN		0x0014
+
+extern int register_netdevice_notifier(struct notifier_block *nb);
+extern int unregister_netdevice_notifier(struct notifier_block *nb);
+extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
+
+
 extern rwlock_t				dev_base_lock;		/* Device list lock */
 
 
@@ -1648,12 +1681,9 @@ static inline void unregister_netdevice(struct net_device *dev)
 extern int 		netdev_refcnt_read(const struct net_device *dev);
 extern void		free_netdev(struct net_device *dev);
 extern void		synchronize_net(void);
-extern int 		register_netdevice_notifier(struct notifier_block *nb);
-extern int		unregister_netdevice_notifier(struct notifier_block *nb);
 extern int		init_dummy_netdev(struct net_device *dev);
 extern void		netdev_resync_ops(struct net_device *dev);
 
-extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
 extern struct net_device	*dev_get_by_index(struct net *net, int ifindex);
 extern struct net_device	*__dev_get_by_index(struct net *net, int ifindex);
 extern struct net_device	*dev_get_by_index_rcu(struct net *net, int ifindex);
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 9eb25fc..e8a858a 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -187,33 +187,7 @@ static inline int notifier_to_errno(int ret)
  
 /* CPU notfiers are defined in include/linux/cpu.h. */
 
-/* netdevice notifier chain. Please remember to update the rtnetlink
- * notification exclusion list in rtnetlink_event() when adding new
- * types.
- */
-#define NETDEV_UP	0x0001	/* For now you can't veto a device up/down */
-#define NETDEV_DOWN	0x0002
-#define NETDEV_REBOOT	0x0003	/* Tell a protocol stack a network interface
-				   detected a hardware crash and restarted
-				   - we can use this eg to kick tcp sessions
-				   once done */
-#define NETDEV_CHANGE	0x0004	/* Notify device state change */
-#define NETDEV_REGISTER 0x0005
-#define NETDEV_UNREGISTER	0x0006
-#define NETDEV_CHANGEMTU	0x0007
-#define NETDEV_CHANGEADDR	0x0008
-#define NETDEV_GOING_DOWN	0x0009
-#define NETDEV_CHANGENAME	0x000A
-#define NETDEV_FEAT_CHANGE	0x000B
-#define NETDEV_BONDING_FAILOVER 0x000C
-#define NETDEV_PRE_UP		0x000D
-#define NETDEV_PRE_TYPE_CHANGE	0x000E
-#define NETDEV_POST_TYPE_CHANGE	0x000F
-#define NETDEV_POST_INIT	0x0010
-#define NETDEV_UNREGISTER_BATCH 0x0011
-#define NETDEV_RELEASE		0x0012
-#define NETDEV_NOTIFY_PEERS	0x0013
-#define NETDEV_JOIN		0x0014
+/* netdevice notifiers are defined in include/linux/netdevice.h */
 
 #define SYS_DOWN	0x0001	/* Notify of system down */
 #define SYS_RESTART	SYS_DOWN
-- 
1.7.4.4

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

* [PATCH 3/5] sys: move reboot notifiers into reboot.h
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
  2011-06-22  6:35 ` [PATCH 1/5] cpu: move cpu notifiers into cpu.h Amerigo Wang
  2011-06-22  6:35 ` [PATCH 2/5] net: move netdevice notifiers into netdevice.h Amerigo Wang
@ 2011-06-22  6:35 ` Amerigo Wang
  2011-06-22  6:35 ` [PATCH 4/5] pm: move pm notifiers into suspend.h Amerigo Wang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, netdev, Amerigo Wang, David S. Miller, Lucas De Marchi,
	Paul E. McKenney, Josh Triplett, Jiri Slaby, Greg Kroah-Hartman,
	David Howells, James Morris

It is not necessary to share the same notifier.h.
This patch already moves register_reboot_notifier()
and unregister_reboot_notifier() from kernel/notifier.c to
kernel/sys.c.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
 include/linux/notifier.h |    5 +----
 include/linux/reboot.h   |    5 +++++
 kernel/notifier.c        |   31 -------------------------------
 kernel/sys.c             |   32 +++++++++++++++++++++++++++++++-
 4 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index e8a858a..145c436 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -189,10 +189,7 @@ static inline int notifier_to_errno(int ret)
 
 /* netdevice notifiers are defined in include/linux/netdevice.h */
 
-#define SYS_DOWN	0x0001	/* Notify of system down */
-#define SYS_RESTART	SYS_DOWN
-#define SYS_HALT	0x0002	/* Notify of system halt */
-#define SYS_POWER_OFF	0x0003	/* Notify of system power off */
+/* reboot notifiers are defined in include/linux/reboot.h. */
 
 #define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 3005d5a..e0879a7 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -39,6 +39,11 @@
 
 #include <linux/notifier.h>
 
+#define SYS_DOWN	0x0001	/* Notify of system down */
+#define SYS_RESTART	SYS_DOWN
+#define SYS_HALT	0x0002	/* Notify of system halt */
+#define SYS_POWER_OFF	0x0003	/* Notify of system power off */
+
 extern int register_reboot_notifier(struct notifier_block *);
 extern int unregister_reboot_notifier(struct notifier_block *);
 
diff --git a/kernel/notifier.c b/kernel/notifier.c
index 2488ba7..8d7b435 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -525,37 +525,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh)
 }
 EXPORT_SYMBOL_GPL(srcu_init_notifier_head);
 
-/**
- *	register_reboot_notifier - Register function to be called at reboot time
- *	@nb: Info about notifier function to be called
- *
- *	Registers a function with the list of functions
- *	to be called at reboot time.
- *
- *	Currently always returns zero, as blocking_notifier_chain_register()
- *	always returns zero.
- */
-int register_reboot_notifier(struct notifier_block *nb)
-{
-	return blocking_notifier_chain_register(&reboot_notifier_list, nb);
-}
-EXPORT_SYMBOL(register_reboot_notifier);
-
-/**
- *	unregister_reboot_notifier - Unregister previously registered reboot notifier
- *	@nb: Hook to be unregistered
- *
- *	Unregisters a previously registered reboot
- *	notifier function.
- *
- *	Returns zero on success, or %-ENOENT on failure.
- */
-int unregister_reboot_notifier(struct notifier_block *nb)
-{
-	return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
-}
-EXPORT_SYMBOL(unregister_reboot_notifier);
-
 static ATOMIC_NOTIFIER_HEAD(die_chain);
 
 int notrace __kprobes notify_die(enum die_val val, const char *str,
diff --git a/kernel/sys.c b/kernel/sys.c
index e4128b2..a101ba3 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -8,7 +8,6 @@
 #include <linux/mm.h>
 #include <linux/utsname.h>
 #include <linux/mman.h>
-#include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/prctl.h>
 #include <linux/highuid.h>
@@ -320,6 +319,37 @@ void kernel_restart_prepare(char *cmd)
 }
 
 /**
+ *	register_reboot_notifier - Register function to be called at reboot time
+ *	@nb: Info about notifier function to be called
+ *
+ *	Registers a function with the list of functions
+ *	to be called at reboot time.
+ *
+ *	Currently always returns zero, as blocking_notifier_chain_register()
+ *	always returns zero.
+ */
+int register_reboot_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&reboot_notifier_list, nb);
+}
+EXPORT_SYMBOL(register_reboot_notifier);
+
+/**
+ *	unregister_reboot_notifier - Unregister previously registered reboot notifier
+ *	@nb: Hook to be unregistered
+ *
+ *	Unregisters a previously registered reboot
+ *	notifier function.
+ *
+ *	Returns zero on success, or %-ENOENT on failure.
+ */
+int unregister_reboot_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
+}
+EXPORT_SYMBOL(unregister_reboot_notifier);
+
+/**
  *	kernel_restart - reboot the system
  *	@cmd: pointer to buffer containing command to execute for restart
  *		or %NULL
-- 
1.7.4.4

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

* [PATCH 4/5] pm: move pm notifiers into suspend.h
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
                   ` (2 preceding siblings ...)
  2011-06-22  6:35 ` [PATCH 3/5] sys: move reboot notifiers into reboot.h Amerigo Wang
@ 2011-06-22  6:35 ` Amerigo Wang
  2011-06-22 19:49   ` Rafael J. Wysocki
  2011-06-22  6:35 ` [PATCH 5/5] vt: move vt notifiers into vt.h Amerigo Wang
  2011-06-22  6:42 ` [PATCH 0/5] notifiers: split notifier.h into subsystem headers David Miller
  5 siblings, 1 reply; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, netdev, Amerigo Wang, Chris Ball, Len Brown, Pavel Machek,
	Rafael J. Wysocki, Ohad Ben-Cohen, Linus Walleij, Philip Rakity,
	David S. Miller, Lucas De Marchi, Paul E. McKenney, Josh Triplett,
	linux-mmc, linux-pm

It is not necessary to share the same notifier.h.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
 drivers/mmc/core/core.c  |    3 +++
 include/linux/notifier.h |   10 ++--------
 include/linux/suspend.h  |    8 ++++++++
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 68091dd..2cd4ec5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -23,6 +23,9 @@
 #include <linux/log2.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
+#ifdef CONFIG_PM
+#include <linux/suspend.h>
+#endif
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 145c436..ae8f7d9 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -191,15 +191,9 @@ static inline int notifier_to_errno(int ret)
 
 /* reboot notifiers are defined in include/linux/reboot.h. */
 
-#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
+/* Hibernation and suspend events are defined in include/linux/suspend.h. */
 
-/* Hibernation and suspend events */
-#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
-#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
-#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
-#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
-#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
-#define PM_POST_RESTORE		0x0006 /* Restore failed */
+#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
 /* Console keyboard events.
  * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 083ffea..95bc81c 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -260,6 +260,14 @@ static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
 #endif /* CONFIG_HIBERNATION */
 
+/* Hibernation and suspend events */
+#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
+#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
+#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
+#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
+#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
+#define PM_POST_RESTORE		0x0006 /* Restore failed */
+
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
-- 
1.7.4.4

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

* [PATCH 5/5] vt: move vt notifiers into vt.h
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
                   ` (3 preceding siblings ...)
  2011-06-22  6:35 ` [PATCH 4/5] pm: move pm notifiers into suspend.h Amerigo Wang
@ 2011-06-22  6:35 ` Amerigo Wang
  2011-06-22  6:42 ` [PATCH 0/5] notifiers: split notifier.h into subsystem headers David Miller
  5 siblings, 0 replies; 11+ messages in thread
From: Amerigo Wang @ 2011-06-22  6:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, netdev, Amerigo Wang, David S. Miller, Lucas De Marchi,
	Paul E. McKenney, Josh Triplett

It is not necessary to share the same notifier.h.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
 include/linux/notifier.h |    9 ++-------
 include/linux/vt.h       |    7 +++++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index ae8f7d9..d65746e 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -193,6 +193,8 @@ static inline int notifier_to_errno(int ret)
 
 /* Hibernation and suspend events are defined in include/linux/suspend.h. */
 
+/* Virtual Terminal events are defined in include/linux/vt.h. */
+
 #define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
 /* Console keyboard events.
@@ -206,12 +208,5 @@ static inline int notifier_to_errno(int ret)
 
 extern struct blocking_notifier_head reboot_notifier_list;
 
-/* Virtual Terminal events. */
-#define VT_ALLOCATE		0x0001 /* Console got allocated */
-#define VT_DEALLOCATE		0x0002 /* Console will be deallocated */
-#define VT_WRITE		0x0003 /* A char got output */
-#define VT_UPDATE		0x0004 /* A bigger update occurred */
-#define VT_PREWRITE		0x0005 /* A char is about to be written to the console */
-
 #endif /* __KERNEL__ */
 #endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/vt.h b/include/linux/vt.h
index d5dd0bc..30a8dd9 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -86,6 +86,13 @@ struct vt_setactivate {
 
 #ifdef __KERNEL__
 
+/* Virtual Terminal events. */
+#define VT_ALLOCATE		0x0001 /* Console got allocated */
+#define VT_DEALLOCATE		0x0002 /* Console will be deallocated */
+#define VT_WRITE		0x0003 /* A char got output */
+#define VT_UPDATE		0x0004 /* A bigger update occurred */
+#define VT_PREWRITE		0x0005 /* A char is about to be written to the console */
+
 #ifdef CONFIG_VT_CONSOLE
 
 extern int vt_kmsg_redirect(int new);
-- 
1.7.4.4

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

* Re: [PATCH 0/5] notifiers: split notifier.h into subsystem headers
  2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
                   ` (4 preceding siblings ...)
  2011-06-22  6:35 ` [PATCH 5/5] vt: move vt notifiers into vt.h Amerigo Wang
@ 2011-06-22  6:42 ` David Miller
  5 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2011-06-22  6:42 UTC (permalink / raw)
  To: amwang; +Cc: linux-kernel, akpm, netdev

From: Amerigo Wang <amwang@redhat.com>
Date: Wed, 22 Jun 2011 14:35:17 +0800

> Now we define all kinds of notifiers in notifier.h, this is not
> necessary at all, since different subsystems use different
> notifiers, they are almost non-related with each other.
> 
> This can also save much build time. Suppose I add a new netdevice
> event, really I don't have to recompile all the source, just network
> related. Without this patch, all the source will be recompiled.
> 
> I move the notify events near to their subsystem notifier registers,
> so that they can be found more easily.
> 
> In case of conflicts, I hope Andrew Morton would take the whole
> patchset, rather than different subsystem maintainers take their own.
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>

For networking bits:

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
  2011-06-22  6:35 ` [PATCH 4/5] pm: move pm notifiers into suspend.h Amerigo Wang
@ 2011-06-22 19:49   ` Rafael J. Wysocki
  2011-06-23  5:03     ` Cong Wang
  0 siblings, 1 reply; 11+ messages in thread
From: Rafael J. Wysocki @ 2011-06-22 19:49 UTC (permalink / raw)
  To: Amerigo Wang
  Cc: linux-kernel, akpm, netdev, Chris Ball, Len Brown, Pavel Machek,
	Ohad Ben-Cohen, Linus Walleij, Philip Rakity, David S. Miller,
	Lucas De Marchi, Paul E. McKenney, Josh Triplett, linux-mmc,
	linux-pm

On Wednesday, June 22, 2011, Amerigo Wang wrote:
> It is not necessary to share the same notifier.h.
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>
> 
> ---
>  drivers/mmc/core/core.c  |    3 +++
>  include/linux/notifier.h |   10 ++--------
>  include/linux/suspend.h  |    8 ++++++++
>  3 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 68091dd..2cd4ec5 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -23,6 +23,9 @@
>  #include <linux/log2.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/pm_runtime.h>
> +#ifdef CONFIG_PM
> +#include <linux/suspend.h>
> +#endif

I don't think the #ifdef in necessary.  Any dependencies on CONFIG_PM
(or CONFIG_SUSPEND etc.) should be taken care of inside of suspend.h.
This file should be fixed if they aren't.

>  #include <linux/mmc/card.h>
>  #include <linux/mmc/host.h>
> diff --git a/include/linux/notifier.h b/include/linux/notifier.h
> index 145c436..ae8f7d9 100644
> --- a/include/linux/notifier.h
> +++ b/include/linux/notifier.h
> @@ -191,15 +191,9 @@ static inline int notifier_to_errno(int ret)
>  
>  /* reboot notifiers are defined in include/linux/reboot.h. */
>  
> -#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
> +/* Hibernation and suspend events are defined in include/linux/suspend.h. */
>  
> -/* Hibernation and suspend events */
> -#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
> -#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
> -#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
> -#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
> -#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
> -#define PM_POST_RESTORE		0x0006 /* Restore failed */
> +#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
>  
>  /* Console keyboard events.
>   * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index 083ffea..95bc81c 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -260,6 +260,14 @@ static inline int hibernate(void) { return -ENOSYS; }
>  static inline bool system_entering_hibernation(void) { return false; }
>  #endif /* CONFIG_HIBERNATION */
>  
> +/* Hibernation and suspend events */
> +#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
> +#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
> +#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
> +#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
> +#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
> +#define PM_POST_RESTORE		0x0006 /* Restore failed */
> +
>  #ifdef CONFIG_PM_SLEEP
>  void save_processor_state(void);
>  void restore_processor_state(void);
> 

Thanks,
Rafael

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

* Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
  2011-06-22 19:49   ` Rafael J. Wysocki
@ 2011-06-23  5:03     ` Cong Wang
  2011-06-23 12:04       ` Rafael J. Wysocki
  2011-06-23 20:24       ` Pavel Machek
  0 siblings, 2 replies; 11+ messages in thread
From: Cong Wang @ 2011-06-23  5:03 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-kernel, akpm, netdev, Chris Ball, Len Brown, Pavel Machek,
	Ohad Ben-Cohen, Linus Walleij, Philip Rakity, David S. Miller,
	Lucas De Marchi, Paul E. McKenney, Josh Triplett, linux-mmc,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

于 2011年06月23日 03:49, Rafael J. Wysocki 写道:
>> +#ifdef CONFIG_PM
>> >  +#include<linux/suspend.h>
>> >  +#endif
> I don't think the #ifdef in necessary.  Any dependencies on CONFIG_PM
> (or CONFIG_SUSPEND etc.) should be taken care of inside of suspend.h.
> This file should be fixed if they aren't.
>

Ok, please check the updated version below.

Thanks.


[-- Attachment #2: pm-move-pm-notifiers-into-suspend.h.patch --]
[-- Type: text/plain, Size: 2376 bytes --]

Author: Amerigo Wang <amwang@redhat.com>

    pm: move pm notifiers into suspend.h

Signed-off-by: WANG Cong <amwang@redhat.com>

---
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 68091dd..503dbc9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -23,6 +23,7 @@
 #include <linux/log2.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
+#include <linux/suspend.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 145c436..ae8f7d9 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -191,15 +191,9 @@ static inline int notifier_to_errno(int ret)
 
 /* reboot notifiers are defined in include/linux/reboot.h. */
 
-#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
+/* Hibernation and suspend events are defined in include/linux/suspend.h. */
 
-/* Hibernation and suspend events */
-#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
-#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
-#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
-#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
-#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
-#define PM_POST_RESTORE		0x0006 /* Restore failed */
+#define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */
 
 /* Console keyboard events.
  * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 083ffea..95bc81c 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -260,6 +260,14 @@ static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
 #endif /* CONFIG_HIBERNATION */
 
+/* Hibernation and suspend events */
+#define PM_HIBERNATION_PREPARE	0x0001 /* Going to hibernate */
+#define PM_POST_HIBERNATION	0x0002 /* Hibernation finished */
+#define PM_SUSPEND_PREPARE	0x0003 /* Going to suspend the system */
+#define PM_POST_SUSPEND		0x0004 /* Suspend finished */
+#define PM_RESTORE_PREPARE	0x0005 /* Going to restore a saved image */
+#define PM_POST_RESTORE		0x0006 /* Restore failed */
+
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);

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

* Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
  2011-06-23  5:03     ` Cong Wang
@ 2011-06-23 12:04       ` Rafael J. Wysocki
  2011-06-23 20:24       ` Pavel Machek
  1 sibling, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2011-06-23 12:04 UTC (permalink / raw)
  To: Cong Wang
  Cc: linux-kernel, akpm, netdev, Chris Ball, Len Brown, Pavel Machek,
	Ohad Ben-Cohen, Linus Walleij, Philip Rakity, David S. Miller,
	Lucas De Marchi, Paul E. McKenney, Josh Triplett, linux-mmc,
	linux-pm

On Thursday, June 23, 2011, Cong Wang wrote:
> 于 2011年06月23日 03:49, Rafael J. Wysocki 写道:
> >> +#ifdef CONFIG_PM
> >> >  +#include<linux/suspend.h>
> >> >  +#endif
> > I don't think the #ifdef in necessary.  Any dependencies on CONFIG_PM
> > (or CONFIG_SUSPEND etc.) should be taken care of inside of suspend.h.
> > This file should be fixed if they aren't.
> >
> 
> Ok, please check the updated version below.

That's fine by me.  Please feel free to add my ACK to the patch.

Thanks,
Rafael

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

* Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
  2011-06-23  5:03     ` Cong Wang
  2011-06-23 12:04       ` Rafael J. Wysocki
@ 2011-06-23 20:24       ` Pavel Machek
  1 sibling, 0 replies; 11+ messages in thread
From: Pavel Machek @ 2011-06-23 20:24 UTC (permalink / raw)
  To: Cong Wang
  Cc: Rafael J. Wysocki, linux-kernel, akpm, netdev, Chris Ball,
	Len Brown, Ohad Ben-Cohen, Linus Walleij, Philip Rakity,
	David S. Miller, Lucas De Marchi, Paul E. McKenney, Josh Triplett,
	linux-mmc, linux-pm

On Thu 2011-06-23 13:03:54, Cong Wang wrote:
> ??? 2011???06???23??? 03:49, Rafael J. Wysocki ??????:
> >>+#ifdef CONFIG_PM
> >>>  +#include<linux/suspend.h>
> >>>  +#endif
> >I don't think the #ifdef in necessary.  Any dependencies on CONFIG_PM
> >(or CONFIG_SUSPEND etc.) should be taken care of inside of suspend.h.
> >This file should be fixed if they aren't.
> >
> 
> Ok, please check the updated version below.
> 
> Thanks.
> 

> Author: Amerigo Wang <amwang@redhat.com>
> 
>     pm: move pm notifiers into suspend.h
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>

ACK.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2011-06-23 20:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-22  6:35 [PATCH 0/5] notifiers: split notifier.h into subsystem headers Amerigo Wang
2011-06-22  6:35 ` [PATCH 1/5] cpu: move cpu notifiers into cpu.h Amerigo Wang
2011-06-22  6:35 ` [PATCH 2/5] net: move netdevice notifiers into netdevice.h Amerigo Wang
2011-06-22  6:35 ` [PATCH 3/5] sys: move reboot notifiers into reboot.h Amerigo Wang
2011-06-22  6:35 ` [PATCH 4/5] pm: move pm notifiers into suspend.h Amerigo Wang
2011-06-22 19:49   ` Rafael J. Wysocki
2011-06-23  5:03     ` Cong Wang
2011-06-23 12:04       ` Rafael J. Wysocki
2011-06-23 20:24       ` Pavel Machek
2011-06-22  6:35 ` [PATCH 5/5] vt: move vt notifiers into vt.h Amerigo Wang
2011-06-22  6:42 ` [PATCH 0/5] notifiers: split notifier.h into subsystem headers David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).