[PATCH] snsc: switch from force_sig to kill_proc
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Jul 2006 11:45:37 +0000 (04:45 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 10 Jul 2006 20:24:26 +0000 (13:24 -0700)
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>
drivers/char/snsc_event.c

index 8b2210b633dfc2845396451d573507d69f566fd2..d12d4f629cec80ca1137fc4e0fc8ad0351f8bfa2 100644 (file)
@@ -220,20 +220,7 @@ scdrv_dispatch_event(char *event, int len)
                               " Sending SIGPWR to init...\n");
 
                /* give a SIGPWR signal to init proc */
-
-               /* first find init's task */
-               read_lock(&tasklist_lock);
-               for_each_process(p) {
-                       if (p->pid == 1)
-                               break;
-               }
-               if (p) {
-                       force_sig(SIGPWR, p);
-               } else {
-                       printk(KERN_ERR "Failed to signal init!\n");
-                       snsc_shutting_down = 0; /* so can try again (?) */
-               }
-               read_unlock(&tasklist_lock);
+               kill_proc(1, SIGPWR, 0);
        } else {
                /* print to system log */
                printk("%s|$(0x%x)%s\n", severity, esp_code, desc);