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

[PATCH] snsc: switch from force_sig to kill_proc

Currently the snsc driver uses force_sig to send init a SIGPWR when the
system overheats. This patch switches it to kill_proc instead which has
the following advantages:

(1) gets rid of one of the last remaining tasklist_lock users
in modular code
(2) simplifies the snsc code significantly

The downside is that an init implementation could in theory block SIGPWR
and it would not get delivered. The sysvinit code used by all major
distributions doesn't do this and blocking this signal in init would be a
rather stupid thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Christoph Hellwig and committed by
Linus Torvalds
5c318bef babcfade

+1 -14
+1 -14
drivers/char/snsc_event.c
··· 220 220 " Sending SIGPWR to init...\n"); 221 221 222 222 /* give a SIGPWR signal to init proc */ 223 - 224 - /* first find init's task */ 225 - read_lock(&tasklist_lock); 226 - for_each_process(p) { 227 - if (p->pid == 1) 228 - break; 229 - } 230 - if (p) { 231 - force_sig(SIGPWR, p); 232 - } else { 233 - printk(KERN_ERR "Failed to signal init!\n"); 234 - snsc_shutting_down = 0; /* so can try again (?) */ 235 - } 236 - read_unlock(&tasklist_lock); 223 + kill_proc(1, SIGPWR, 0); 237 224 } else { 238 225 /* print to system log */ 239 226 printk("%s|$(0x%x)%s\n", severity, esp_code, desc);