]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/char/random.c
sparse irq_desc[] array: core kernel and x86 changes
[karo-tx-linux.git] / drivers / char / random.c
index c8752eaad483eea52b4dbc8c8af87eaf931ad189..d26891bfcd4154effba426421322ed053acb9d9b 100644 (file)
@@ -558,8 +558,11 @@ struct timer_rand_state {
        unsigned dont_count_entropy:1;
 };
 
+#ifndef CONFIG_SPARSE_IRQ
+struct timer_rand_state *irq_timer_state[NR_IRQS];
+#endif
+
 static struct timer_rand_state input_timer_state;
-static struct timer_rand_state *irq_timer_state[NR_IRQS];
 
 /*
  * This function adds entropy to the entropy "pool" by using timing
@@ -648,11 +651,15 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
 
 void add_interrupt_randomness(int irq)
 {
-       if (irq >= NR_IRQS || irq_timer_state[irq] == NULL)
+       struct timer_rand_state *state;
+
+       state = get_timer_rand_state(irq);
+
+       if (state == NULL)
                return;
 
        DEBUG_ENT("irq event %d\n", irq);
-       add_timer_randomness(irq_timer_state[irq], 0x100 + irq);
+       add_timer_randomness(state, 0x100 + irq);
 }
 
 #ifdef CONFIG_BLOCK
@@ -912,7 +919,14 @@ void rand_initialize_irq(int irq)
 {
        struct timer_rand_state *state;
 
-       if (irq >= NR_IRQS || irq_timer_state[irq])
+#ifndef CONFIG_SPARSE_IRQ
+       if (irq >= nr_irqs)
+               return;
+#endif
+
+       state = get_timer_rand_state(irq);
+
+       if (state)
                return;
 
        /*
@@ -921,7 +935,7 @@ void rand_initialize_irq(int irq)
         */
        state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
        if (state)
-               irq_timer_state[irq] = state;
+               set_timer_rand_state(irq, state);
 }
 
 #ifdef CONFIG_BLOCK
@@ -1113,18 +1127,12 @@ static int random_fasync(int fd, struct file *filp, int on)
        return fasync_helper(fd, filp, on, &fasync);
 }
 
-static int random_release(struct inode *inode, struct file *filp)
-{
-       return fasync_helper(-1, filp, 0, &fasync);
-}
-
 const struct file_operations random_fops = {
        .read  = random_read,
        .write = random_write,
        .poll  = random_poll,
        .unlocked_ioctl = random_ioctl,
        .fasync = random_fasync,
-       .release = random_release,
 };
 
 const struct file_operations urandom_fops = {
@@ -1132,7 +1140,6 @@ const struct file_operations urandom_fops = {
        .write = random_write,
        .unlocked_ioctl = random_ioctl,
        .fasync = random_fasync,
-       .release = random_release,
 };
 
 /***************************************************************