[PATCH] uml: Use ARRAY_SIZE more assiduously
[powerpc.git] / arch / um / drivers / mconsole_kern.c
index 28e3760..79610b5 100644 (file)
@@ -62,7 +62,7 @@ static void mc_work_proc(void *unused)
        unsigned long flags;
 
        while(!list_empty(&mc_requests)){
-               local_save_flags(flags);
+               local_irq_save(flags);
                req = list_entry(mc_requests.next, struct mconsole_entry,
                                 list);
                list_del(&req->list);
@@ -87,7 +87,7 @@ static irqreturn_t mconsole_interrupt(int irq, void *dev_id,
                if(req.cmd->context == MCONSOLE_INTR)
                        (*req.cmd->handler)(&req);
                else {
-                       new = kmalloc(sizeof(*new), GFP_ATOMIC);
+                       new = kmalloc(sizeof(*new), GFP_NOWAIT);
                        if(new == NULL)
                                mconsole_reply(&req, "Out of memory", 1, 0);
                        else {
@@ -300,8 +300,6 @@ void mconsole_reboot(struct mc_request *req)
        machine_restart(NULL);
 }
 
-extern void ctrl_alt_del(void);
-
 void mconsole_cad(struct mc_request *req)
 {
        mconsole_reply(req, "", 0, 0);
@@ -415,7 +413,6 @@ static int mem_config(char *str)
 
                        unplugged = page_address(page);
                        if(unplug_index == UNPLUGGED_PER_PAGE){
-                               INIT_LIST_HEAD(&unplugged->list);
                                list_add(&unplugged->list, &unplugged_pages);
                                unplug_index = 0;
                        }
@@ -500,7 +497,7 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
        }
 
        error = NULL;
-       size = sizeof(default_buf)/sizeof(default_buf[0]);
+       size = ARRAY_SIZE(default_buf);
        buf = default_buf;
 
        while(1){
@@ -616,7 +613,7 @@ static void console_write(struct console *console, const char *string,
                return;
 
        while(1){
-               n = min((size_t)len, ARRAY_SIZE(console_buf) - console_index);
+               n = min((size_t) len, ARRAY_SIZE(console_buf) - console_index);
                strncpy(&console_buf[console_index], string, n);
                console_index += n;
                string += n;
@@ -655,7 +652,6 @@ static void with_console(struct mc_request *req, void (*proc)(void *),
        struct mconsole_entry entry;
        unsigned long flags;
 
-       INIT_LIST_HEAD(&entry.list);
        entry.request = *req;
        list_add(&entry.list, &clients);
        spin_lock_irqsave(&console_lock, flags);
@@ -781,7 +777,7 @@ static int mconsole_init(void)
        register_reboot_notifier(&reboot_notifier);
 
        err = um_request_irq(MCONSOLE_IRQ, sock, IRQ_READ, mconsole_interrupt,
-                            SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
+                            IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
                             "mconsole", (void *)sock);
        if (err){
                printk("Failed to get IRQ for management console\n");