From: Amerigo Wang <hidden> Date: 2011-06-22 06:36:09
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 <redacted>
---
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(-)
From: Amerigo Wang <hidden> Date: 2011-06-22 06:36:37
It is not necessary to share the same notifier.h.
Signed-off-by: WANG Cong <redacted>
---
include/linux/netdevice.h | 36 +++++++++++++++++++++++++++++++++---
include/linux/notifier.h | 28 +---------------------------
2 files changed, 34 insertions(+), 30 deletions(-)
From: Amerigo Wang <hidden> Date: 2011-06-22 06:37:11
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 <redacted>
---
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(-)
@@ -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 */
@@ -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 */+externintregister_reboot_notifier(structnotifier_block*);externintunregister_reboot_notifier(structnotifier_block*);
From: Amerigo Wang <hidden> Date: 2011-06-22 06:37:17
It is not necessary to share the same notifier.h.
Signed-off-by: WANG Cong <redacted>
---
include/linux/notifier.h | 9 ++-------
include/linux/vt.h | 7 +++++++
2 files changed, 9 insertions(+), 7 deletions(-)
@@ -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)externstructblocking_notifier_headreboot_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 */
@@ -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_CONSOLEexternintvt_kmsg_redirect(intnew);
From: Amerigo Wang <hidden> Date: 2011-06-22 06:37:21
It is not necessary to share the same notifier.h.
Signed-off-by: WANG Cong <redacted>
---
include/linux/cpu.h | 33 +++++++++++++++++++++++++++++++++
include/linux/notifier.h | 34 ++--------------------------------
net/rds/page.c | 1 +
3 files changed, 36 insertions(+), 32 deletions(-)
@@ -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,+*nothandlinginterrupts,soondead.+*Calledonthedyingcpu,interrupts+*arealreadydisabled.Mustnot+*sleep,mustnotfail*/+#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug+*lockisdropped*/+#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.+*Calledonthenewcpu,justbefore+*enablinginterrupts.Mustnotsleep,+*mustnotfail*/++/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend+*operationinprogress+*/+#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)
@@ -185,6 +185,8 @@ static inline int notifier_to_errno(int ret)*VCswitchchains(forloadablekernelsvgalibVCswitchhelpers)etc...*/+/* CPU notfiers are defined in include/linux/cpu.h. */+/* netdevice notifier chain. Please remember to update the rtnetlink*notificationexclusionlistinrtnetlink_event()whenaddingnew*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,-*nothandlinginterrupts,soondead.-*Calledonthedyingcpu,interrupts-*arealreadydisabled.Mustnot-*sleep,mustnotfail*/-#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug-*lockisdropped*/-#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.-*Calledonthenewcpu,justbefore-*enablinginterrupts.Mustnotsleep,-*mustnotfail*/--/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend-*operationinprogress-*/-#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 */
From: Amerigo Wang <hidden> Date: 2011-06-22 06:38:07
It is not necessary to share the same notifier.h.
Signed-off-by: WANG Cong <redacted>
---
drivers/mmc/core/core.c | 3 +++
include/linux/notifier.h | 10 ++--------
include/linux/suspend.h | 8 ++++++++
3 files changed, 13 insertions(+), 8 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2011-06-22 06:42:50
From: Amerigo Wang <redacted>
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 <redacted>
For networking bits:
Acked-by: David S. Miller <davem@davemloft.net>
From: Rafael J. Wysocki <hidden> Date: 2011-06-22 19:48:46
On Wednesday, June 22, 2011, Amerigo Wang wrote:
quoted hunk
It is not necessary to share the same notifier.h.
Signed-off-by: WANG Cong <redacted>
---
drivers/mmc/core/core.c | 3 +++
include/linux/notifier.h | 10 ++--------
include/linux/suspend.h | 8 ++++++++
3 files changed, 13 insertions(+), 8 deletions(-)
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.
From: Cong Wang <hidden> Date: 2011-06-23 05:04:58
于 2011年06月23日 03:49, Rafael J. Wysocki 写道:
quoted
+#ifdef CONFIG_PM
quoted
+#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.
From: Rafael J. Wysocki <hidden> Date: 2011-06-23 12:03:26
On Thursday, June 23, 2011, Cong Wang wrote:
于 2011年06月23日 03:49, Rafael J. Wysocki 写道:
quoted
quoted
+#ifdef CONFIG_PM
quoted
+#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
From: Pavel Machek <hidden> Date: 2011-06-23 20:24:26
On Thu 2011-06-23 13:03:54, Cong Wang wrote:
??? 2011???06???23??? 03:49, Rafael J. Wysocki ??????:
quoted
quoted
+#ifdef CONFIG_PM
quoted
+#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 [off-list ref]
pm: move pm notifiers into suspend.h
Signed-off-by: WANG Cong <redacted>