Commit 8f68fa2d1908365cb372b1aebf89d6af4b2b3871
Committed by
Linus Torvalds
1 parent
f02c696800
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 8 additions and 7 deletions Side-by-side Diff
ipc/util.c
... | ... | @@ -23,6 +23,7 @@ |
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> |
29 | 30 | |
30 | 31 | |
... | ... | @@ -47,19 +48,16 @@ |
47 | 48 | int (*show)(struct seq_file *, void *); |
48 | 49 | }; |
49 | 50 | |
50 | -#ifdef CONFIG_MEMORY_HOTPLUG | |
51 | - | |
52 | 51 | static void ipc_memory_notifier(struct work_struct *work) |
53 | 52 | { |
54 | 53 | ipcns_notify(IPCNS_MEMCHANGED); |
55 | 54 | } |
56 | 55 | |
57 | -static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); | |
58 | - | |
59 | - | |
60 | 56 | static int ipc_memory_callback(struct notifier_block *self, |
61 | 57 | unsigned long action, void *arg) |
62 | 58 | { |
59 | + static DECLARE_WORK(ipc_memory_wq, ipc_memory_notifier); | |
60 | + | |
63 | 61 | switch (action) { |
64 | 62 | case MEM_ONLINE: /* memory successfully brought online */ |
65 | 63 | case MEM_OFFLINE: /* or offline: it's time to recompute msgmni */ |
... | ... | @@ -85,7 +83,10 @@ |
85 | 83 | return NOTIFY_OK; |
86 | 84 | } |
87 | 85 | |
88 | -#endif /* CONFIG_MEMORY_HOTPLUG */ | |
86 | +static struct notifier_block ipc_memory_nb = { | |
87 | + .notifier_call = ipc_memory_callback, | |
88 | + .priority = IPC_CALLBACK_PRI, | |
89 | +}; | |
89 | 90 | |
90 | 91 | /** |
91 | 92 | * ipc_init - initialise IPC subsystem |
... | ... | @@ -102,7 +103,7 @@ |
102 | 103 | sem_init(); |
103 | 104 | msg_init(); |
104 | 105 | shm_init(); |
105 | - hotplug_memory_notifier(ipc_memory_callback, IPC_CALLBACK_PRI); | |
106 | + register_hotmemory_notifier(&ipc_memory_nb); | |
106 | 107 | register_ipcns_notifier(&init_ipc_ns); |
107 | 108 | return 0; |
108 | 109 | } |