]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/um/os-Linux/irq.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / arch / um / os-Linux / irq.c
index e599be423da10ac08b6fa7a064a8d906f2c6c70b..a97206df5b52068ffe20b3b0979653c4e384d28b 100644 (file)
@@ -29,21 +29,21 @@ int os_waiting_for_events(struct irq_fd *active_fds)
        int i, n, err;
 
        n = poll(pollfds, pollfds_num, 0);
-       if(n < 0){
+       if (n < 0) {
                err = -errno;
-               if(errno != EINTR)
+               if (errno != EINTR)
                        printk("sigio_handler: os_waiting_for_events:"
                               " poll returned %d, errno = %d\n", n, errno);
                return err;
        }
 
-       if(n == 0)
+       if (n == 0)
                return 0;
 
        irq_fd = active_fds;
 
-       for(i = 0; i < pollfds_num; i++){
-               if(pollfds[i].revents != 0){
+       for (i = 0; i < pollfds_num; i++) {
+               if (pollfds[i].revents != 0) {
                        irq_fd->current_events = pollfds[i].revents;
                        pollfds[i].fd = -1;
                }
@@ -52,11 +52,6 @@ int os_waiting_for_events(struct irq_fd *active_fds)
        return n;
 }
 
-int os_isatty(int fd)
-{
-       return(isatty(fd));
-}
-
 int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
 {
        if (pollfds_num == pollfds_size) {
@@ -65,7 +60,7 @@ int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
                        return((pollfds_size + 1) * sizeof(pollfds[0]));
                }
 
-               if(pollfds != NULL){
+               if (pollfds != NULL) {
                        memcpy(tmp_pfd, pollfds,
                               sizeof(pollfds[0]) * pollfds_size);
                        /* remove old pollfds */
@@ -73,18 +68,15 @@ int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
                }
                pollfds = tmp_pfd;
                pollfds_size++;
-       } else {
-               /* remove not used tmp_pfd */
-               if (tmp_pfd != NULL)
-                       kfree(tmp_pfd);
-       }
+       } else
+               kfree(tmp_pfd); /* remove not used tmp_pfd */
 
-       pollfds[pollfds_num] = ((struct pollfd) { .fd   = fd,
-                                                 .events       = events,
-                                                 .revents      = 0 });
+       pollfds[pollfds_num] = ((struct pollfd) { .fd           = fd,
+                                                 .events       = events,
+                                                 .revents      = 0 });
        pollfds_num++;
 
-       return(0);
+       return 0;
 }
 
 void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
@@ -94,11 +86,11 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
        int i = 0;
 
        prev = &active_fds;
-       while(*prev != NULL){
-               if((*test)(*prev, arg)){
+       while (*prev != NULL) {
+               if ((*test)(*prev, arg)) {
                        struct irq_fd *old_fd = *prev;
-                       if((pollfds[i].fd != -1) &&
-                          (pollfds[i].fd != (*prev)->fd)){
+                       if ((pollfds[i].fd != -1) &&
+                           (pollfds[i].fd != (*prev)->fd)) {
                                printk("os_free_irq_by_cb - mismatch between "
                                       "active_fds and pollfds, fd %d vs %d\n",
                                       (*prev)->fd, pollfds[i].fd);
@@ -110,7 +102,6 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
                        /* This moves the *whole* array after pollfds[i]
                         * (though it doesn't spot as such)!
                         */
-
                        memmove(&pollfds[i], &pollfds[i + 1],
                               (pollfds_num - i) * sizeof(pollfds[0]));
                        if(*last_irq_ptr2 == &old_fd->next)
@@ -129,10 +120,9 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
        return;
 }
 
-
 int os_get_pollfd(int i)
 {
-       return(pollfds[i].fd);
+       return pollfds[i].fd;
 }
 
 void os_set_pollfd(int i, int fd)
@@ -142,20 +132,19 @@ void os_set_pollfd(int i, int fd)
 
 void os_set_ioignore(void)
 {
-       set_handler(SIGIO, SIG_IGN, 0, -1);
+       signal(SIGIO, SIG_IGN);
 }
 
 void init_irq_signals(int on_sigstack)
 {
-       __sighandler_t h;
        int flags;
 
        flags = on_sigstack ? SA_ONSTACK : 0;
-       if(timer_irq_inited) h = (__sighandler_t) alarm_handler;
-       else h = boot_timer_handler;
 
-       set_handler(SIGVTALRM, h, flags | SA_RESTART,
-                   SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
+       set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
+                   flags | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
+       set_handler(SIGALRM, (__sighandler_t) alarm_handler,
+                   flags | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
        set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
                    SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
        signal(SIGWINCH, SIG_IGN);