Commit 8f68fa2d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

ipc/util.c: use register_hotmemory_notifier()

Squishes a statement-with-no-effect warning, removes some ifdefs and
shrinks .text by one byte!

Note that this code fails to check for blocking_notifier_chain_register()
failures.
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f02c6968
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/msg.h> #include <linux/msg.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/notifier.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/security.h> #include <linux/security.h>
...@@ -47,19 +48,16 @@ struct ipc_proc_iface { ...@@ -47,19 +48,16 @@ struct ipc_proc_iface {
int (*show)(struct seq_file *, void *); int (*show)(struct seq_file *, void *);
}; };
#ifdef CONFIG_MEMORY_HOTPLUG
static void ipc_memory_notifier(struct work_struct *work) static void ipc_memory_notifier(struct work_struct *work)
{ {
ipcns_notify(IPCNS_MEMCHANGED); ipcns_notify(IPCNS_MEMCHANGED);
} }
static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier);
static int ipc_memory_callback(struct notifier_block *self, static int ipc_memory_callback(struct notifier_block *self,
unsigned long action, void *arg) unsigned long action, void *arg)
{ {
static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier);
switch (action) { switch (action) {
case MEM_ONLINE: /* memory successfully brought online */ case MEM_ONLINE: /* memory successfully brought online */
case MEM_OFFLINE: /* or offline: it's time to recompute msgmni */ case MEM_OFFLINE: /* or offline: it's time to recompute msgmni */
...@@ -85,7 +83,10 @@ static int ipc_memory_callback(struct notifier_block *self, ...@@ -85,7 +83,10 @@ static int ipc_memory_callback(struct notifier_block *self,
return NOTIFY_OK; return NOTIFY_OK;
} }
#endif /* CONFIG_MEMORY_HOTPLUG */ static struct notifier_block ipc_memory_nb = {
.notifier_call = ipc_memory_callback,
.priority = IPC_CALLBACK_PRI,
};
/** /**
* ipc_init - initialise IPC subsystem * ipc_init - initialise IPC subsystem
...@@ -102,7 +103,7 @@ static int __init ipc_init(void) ...@@ -102,7 +103,7 @@ static int __init ipc_init(void)
sem_init(); sem_init();
msg_init(); msg_init();
shm_init(); shm_init();
hotplug_memory_notifier(ipc_memory_callback, IPC_CALLBACK_PRI); register_hotmemory_notifier(&ipc_memory_nb);
register_ipcns_notifier(&init_ipc_ns); register_ipcns_notifier(&init_ipc_ns);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment