[PATCH] uml: IRQ handler tidying
authorJeff Dike <jdike@addtoit.com>
Sat, 10 Feb 2007 09:44:23 +0000 (01:44 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 18:51:23 +0000 (10:51 -0800)
Tidying the irq code -
make a variable static
activate_fd can call kmalloc directly since it's now kernel code
added a no-locking comment
fixed a style violation

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/kernel/irq.c
arch/um/os-Linux/irq.c

index 5c1e611f628d548fed1716c75d5537c39d6b8cc4..50a288bb875a87ec10e977db3f366358c15d29d8 100644 (file)
@@ -79,7 +79,7 @@ skip:
        return 0;
 }
 
-struct irq_fd *active_fds = NULL;
+static struct irq_fd *active_fds = NULL;
 static struct irq_fd **last_irq_ptr = &active_fds;
 
 extern void free_irqs(void);
@@ -124,8 +124,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
        if (err < 0)
                goto out;
 
-       new_fd = um_kmalloc(sizeof(*new_fd));
        err = -ENOMEM;
+       new_fd = kmalloc(sizeof(struct irq_fd), GFP_KERNEL);
        if (new_fd == NULL)
                goto out;
 
@@ -176,9 +176,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
                 */
                spin_unlock_irqrestore(&irq_lock, flags);
                kfree(tmp_pfd);
-               tmp_pfd = NULL;
 
-               tmp_pfd = um_kmalloc(n);
+               tmp_pfd = kmalloc(n, GFP_KERNEL);
                if (tmp_pfd == NULL)
                        goto out_kfree;
 
index d46b818c1311258934679b82fdd0685afeaecbca..d1b61d474e0a0a535423f74b097b851bf0b05677 100644 (file)
 #include "os.h"
 #include "um_malloc.h"
 
+/*
+ * Locked by irq_lock in arch/um/kernel/irq.c.  Changed by os_create_pollfd
+ * and os_free_irq_by_cb, which are called under irq_lock.
+ */
 static struct pollfd *pollfds = NULL;
 static int pollfds_num = 0;
 static int pollfds_size = 0;
@@ -58,7 +62,7 @@ int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
        if (pollfds_num == pollfds_size) {
                if (size_tmpfds <= pollfds_size * sizeof(pollfds[0])) {
                        /* return min size needed for new pollfds area */
-                       return((pollfds_size + 1) * sizeof(pollfds[0]));
+                       return (pollfds_size + 1) * sizeof(pollfds[0]);
                }
 
                if (pollfds != NULL) {