notifiers: split notifier.h into subsystem headers
Subsystems (8)
cover notifiers: split notifier.h into subsystem headers
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.
--- 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(-)
PATCH 1/5 cpu: move cpu notifiers into cpu.h
It is not necessary to share the same notifier.h.
--- include/linux/cpu.h | 33 +++++++++++++++++++++++++++++++++ include/linux/notifier.h | 34 ++-------------------------------- net/rds/page.c | 1 + 3 files changed, 36 insertions(+), 32 deletions(-)
include/linux/cpu.h +33 -0
@@ -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 )
include/linux/notifier.h +2 -32
@@ -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 */
net/rds/page.c +1 -0
@@ -32,6 +32,7 @@*/ #include <linux/highmem.h> #include <linux/gfp.h> +#include <linux/cpu.h> #include "rds.h"
Signature · 1 line
1.7.4.4
PATCH 2/5 net: move netdevice notifiers into netdevice.h
In reply to Amerigo WangIt is not necessary to share the same notifier.h.
--- include/linux/netdevice.h | 36 +++++++++++++++++++++++++++++++++--- include/linux/notifier.h | 28 +--------------------------- 2 files changed, 34 insertions(+), 30 deletions(-)
include/linux/netdevice.h +33 -3
@@ -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);
include/linux/notifier.h +1 -27
@@ -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
Signature · 1 line
1.7.4.4
PATCH 3/5 sys: move reboot notifiers into reboot.h
In reply to Amerigo WangIt 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.
--- 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(-)
include/linux/notifier.h +1 -4
@@ -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 */
include/linux/reboot.h +5 -0
@@ -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 *);
kernel/notifier.c +0 -31
@@ -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,
kernel/sys.c +31 -1
@@ -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
Signature · 1 line
1.7.4.4
PATCH 4/5 pm: move pm notifiers into suspend.h
In reply to Amerigo WangIt is not necessary to share the same notifier.h.
--- drivers/mmc/core/core.c | 3 +++ include/linux/notifier.h | 10 ++-------- include/linux/suspend.h | 8 ++++++++ 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/mmc/core/core.c +3 -0
@@ -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>
include/linux/notifier.h +2 -8
@@ -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
include/linux/suspend.h +8 -0
@@ -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 );
Signature · 1 line
1.7.4.4
PATCH 4/5 pm: move pm notifiers into suspend.h
In reply to Amerigo WangIt is not necessary to share the same notifier.h.
--- drivers/mmc/core/core.c | 3 +++ include/linux/notifier.h | 10 ++-------- include/linux/suspend.h | 8 ++++++++ 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/mmc/core/core.c +3 -0
@@ -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>
include/linux/notifier.h +2 -8
@@ -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
include/linux/suspend.h +8 -0
@@ -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 );
Signature · 1 line
1.7.4.4
PATCH 5/5 vt: move vt notifiers into vt.h
In reply to Amerigo WangIt is not necessary to share the same notifier.h.
--- include/linux/notifier.h | 9 ++------- include/linux/vt.h | 7 +++++++ 2 files changed, 9 insertions(+), 7 deletions(-)
include/linux/notifier.h +2 -7
@@ -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 */
include/linux/vt.h +7 -0
@@ -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);
Signature · 1 line
1.7.4.4
From: Amerigo Wang <[email protected]>
Date: Wed, 22 Jun 2011 14:35:17 +0800
Quoted 8 lines
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.
Quoted 7 lines
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 <[email protected]>
For networking bits:
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Amerigo WangQuoted 15 lines · Amerigo Wang
It is not necessary to share the same
notifier.h.Signed-off-by WANG Cong <[email protected]>--- drivers/mmc/core/core.c | 3 +++ include/linux/notifier.h | 10 ++-------- include/linux/suspend.h | 8 ++++++++ 3 files changed, 13 insertions(+), 8 deletions(-)drivers/mmc/core/core.c +0
-0
drivers/mmc/core/core.c line 28
Quoted 6 lines
drivers/mmc/core/core.c +3
-0@@ -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.
Quoted 34 lines
drivers/mmc/core/core.c +0
-0#include <linux/mmc/card.h> #include <linux/mmc/host.h> include/linux/notifier.h +2
-8@@ -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 include/linux/suspend.h +1
-0@@ -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 */
include/linux/suspend.h static inline int hibernate(void) { return -ENOSYS; } · line 273
Quoted 10 lines
include/linux/suspend.h +7
-0+#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
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Amerigo WangQuoted 15 lines · Amerigo Wang
It is not necessary to share the same
notifier.h.Signed-off-by WANG Cong <[email protected]>--- drivers/mmc/core/core.c | 3 +++ include/linux/notifier.h | 10 ++-------- include/linux/suspend.h | 8 ++++++++ 3 files changed, 13 insertions(+), 8 deletions(-)drivers/mmc/core/core.c +0
-0
drivers/mmc/core/core.c line 28
Quoted 6 lines
drivers/mmc/core/core.c +3
-0@@ -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.
Quoted 34 lines
drivers/mmc/core/core.c +0
-0#include <linux/mmc/card.h> #include <linux/mmc/host.h> include/linux/notifier.h +2
-8@@ -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 include/linux/suspend.h +1
-0@@ -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 */
include/linux/suspend.h static inline int hibernate(void) { return -ENOSYS; } · line 273
Quoted 10 lines
include/linux/suspend.h +7
-0+#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
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.h. This file should be fixed if they aren't.
Ok, please check the updated version below.
Thanks.
Author: Amerigo Wang <[email protected]>
pm: move pm notifiers into suspend.h
---
drivers/mmc/core/core.c +1 -0
@@ -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>
include/linux/notifier.h +2 -8
@@ -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
include/linux/suspend.h +8 -0
@@ -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 );
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.h. This file should be fixed if they aren't.
Ok, please check the updated version below.
Thanks.
Author: Amerigo Wang <[email protected]>
pm: move pm notifiers into suspend.h
---
drivers/mmc/core/core.c +1 -0
@@ -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>
include/linux/notifier.h +2 -8
@@ -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
include/linux/suspend.h +8 -0
@@ -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 );
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Cong WangQuoted 10 lines · Cong Wang
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.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
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Cong WangQuoted 10 lines · Cong Wang
Quoted 7 lines · Rafael J. Wysocki
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.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
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Cong WangQuoted 11 lines · Cong Wang
??? 2011???06???23??? 03:49, Rafael J. Wysocki ??????:
Quoted 7 lines
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.h. This file should be fixed if they aren't.Ok, please check the updated version below.
Quoted 8 lines
Thanks.
Author: Amerigo Wang <[email protected]>
pm: move pm notifiers into
suspend.hSigned-off-by WANG Cong <[email protected]>
ACK.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
In reply to Cong WangQuoted 11 lines · Cong Wang
??? 2011???06???23??? 03:49, Rafael J. Wysocki ??????:
Quoted 7 lines
Quoted 3 lines
+#ifdef
CONFIG_PMQuoted 2 lines
+#include<linux/suspend.h>
+#endifI don't think the #ifdef in necessary. Any dependencies on
CONFIG_PM(orCONFIG_SUSPENDetc.) should be taken care of inside ofsuspend.h. This file should be fixed if they aren't.Ok, please check the updated version below.
Quoted 8 lines
Thanks.
Author: Amerigo Wang <[email protected]>
pm: move pm notifiers into
suspend.hSigned-off-by WANG Cong <[email protected]>
ACK.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html