include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / char / snsc_event.c
index a4fa507..ee15694 100644 (file)
@@ -17,7 +17,8 @@
 
 #include <linux/interrupt.h>
 #include <linux/sched.h>
-#include <linux/byteorder/generic.h>
+#include <linux/slab.h>
+#include <asm/byteorder.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/unaligned.h>
 #include "snsc.h"
@@ -36,7 +37,7 @@ DECLARE_TASKLET(sn_sysctl_event, scdrv_event, 0);
  * destination.
  */
 static irqreturn_t
-scdrv_event_interrupt(int irq, void *subch_data, struct pt_regs *regs)
+scdrv_event_interrupt(int irq, void *subch_data)
 {
        struct subch_data_s *sd = subch_data;
        unsigned long flags;
@@ -63,16 +64,13 @@ static int
 scdrv_parse_event(char *event, int *src, int *code, int *esp_code, char *desc)
 {
        char *desc_end;
-       __be32 from_buf;
 
        /* record event source address */
-       from_buf = get_unaligned((__be32 *)event);
-       *src = be32_to_cpup(&from_buf);
+       *src = get_unaligned_be32(event);
        event += 4;                     /* move on to event code */
 
        /* record the system controller's event code */
-       from_buf = get_unaligned((__be32 *)event);
-       *code = be32_to_cpup(&from_buf);
+       *code = get_unaligned_be32(event);
        event += 4;                     /* move on to event arguments */
 
        /* how many arguments are in the packet? */
@@ -86,8 +84,7 @@ scdrv_parse_event(char *event, int *src, int *code, int *esp_code, char *desc)
                /* not an integer argument, so give up */
                return -1;
        }
-       from_buf = get_unaligned((__be32 *)event);
-       *esp_code = be32_to_cpup(&from_buf);
+       *esp_code = get_unaligned_be32(event);
        event += 4;
 
        /* parse out the event description */
@@ -203,8 +200,6 @@ scdrv_dispatch_event(char *event, int len)
        class = (code & EV_CLASS_MASK);
 
        if (class == EV_CLASS_PWRD_NOTIFY || code == ENV_PWRDN_PEND) {
-               struct task_struct *p;
-
                if (snsc_shutting_down)
                        return;
 
@@ -220,20 +215,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_cad_pid(SIGPWR, 0);
        } else {
                /* print to system log */
                printk("%s|$(0x%x)%s\n", severity, esp_code, desc);
@@ -287,15 +269,14 @@ scdrv_event_init(struct sysctl_data_s *scd)
 {
        int rv;
 
-       event_sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL);
+       event_sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL);
        if (event_sd == NULL) {
                printk(KERN_WARNING "%s: couldn't allocate subchannel info"
-                      " for event monitoring\n", __FUNCTION__);
+                      " for event monitoring\n", __func__);
                return;
        }
 
        /* initialize subch_data_s fields */
-       memset(event_sd, 0, sizeof (struct subch_data_s));
        event_sd->sd_nasid = scd->scd_nasid;
        spin_lock_init(&event_sd->sd_rlock);
 
@@ -305,21 +286,19 @@ scdrv_event_init(struct sysctl_data_s *scd)
        if (event_sd->sd_subch < 0) {
                kfree(event_sd);
                printk(KERN_WARNING "%s: couldn't open event subchannel\n",
-                      __FUNCTION__);
+                      __func__);
                return;
        }
 
        /* hook event subchannel up to the system controller interrupt */
        rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt,
-                        SA_SHIRQ | SA_INTERRUPT,
+                        IRQF_SHARED | IRQF_DISABLED,
                         "system controller events", event_sd);
        if (rv) {
                printk(KERN_WARNING "%s: irq request failed (%d)\n",
-                      __FUNCTION__, rv);
+                      __func__, rv);
                ia64_sn_irtr_close(event_sd->sd_nasid, event_sd->sd_subch);
                kfree(event_sd);
                return;
        }
 }
-
-