Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrew Morton and committed by
Linus Torvalds
8f68fa2d f02c6968

+8 -7
+8 -7
ipc/util.c
··· 23 23 #include <linux/msg.h> 24 24 #include <linux/vmalloc.h> 25 25 #include <linux/slab.h> 26 + #include <linux/notifier.h> 26 27 #include <linux/capability.h> 27 28 #include <linux/highuid.h> 28 29 #include <linux/security.h> ··· 48 47 int (*show)(struct seq_file *, void *); 49 48 }; 50 49 51 - #ifdef CONFIG_MEMORY_HOTPLUG 52 - 53 50 static void ipc_memory_notifier(struct work_struct *work) 54 51 { 55 52 ipcns_notify(IPCNS_MEMCHANGED); 56 53 } 57 54 58 - static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); 59 - 60 - 61 55 static int ipc_memory_callback(struct notifier_block *self, 62 56 unsigned long action, void *arg) 63 57 { 58 + static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); 59 + 64 60 switch (action) { 65 61 case MEM_ONLINE: /* memory successfully brought online */ 66 62 case MEM_OFFLINE: /* or offline: it's time to recompute msgmni */ ··· 83 85 return NOTIFY_OK; 84 86 } 85 87 86 - #endif /* CONFIG_MEMORY_HOTPLUG */ 88 + static struct notifier_block ipc_memory_nb = { 89 + .notifier_call = ipc_memory_callback, 90 + .priority = IPC_CALLBACK_PRI, 91 + }; 87 92 88 93 /** 89 94 * ipc_init - initialise IPC subsystem ··· 103 102 sem_init(); 104 103 msg_init(); 105 104 shm_init(); 106 - hotplug_memory_notifier(ipc_memory_callback, IPC_CALLBACK_PRI); 105 + register_hotmemory_notifier(&ipc_memory_nb); 107 106 register_ipcns_notifier(&init_ipc_ns); 108 107 return 0; 109 108 }