summaryrefslogtreecommitdiffstats
path: root/drivers/char/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r--drivers/char/random.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 675076f5fca..c7afc068c28 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -558,24 +558,43 @@ struct timer_rand_state {
unsigned dont_count_entropy:1;
};
+#ifndef CONFIG_SPARSE_IRQ
+
static struct timer_rand_state *irq_timer_state[NR_IRQS];
static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
{
- if (irq >= nr_irqs)
- return NULL;
-
return irq_timer_state[irq];
}
-static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
+static void set_timer_rand_state(unsigned int irq,
+ struct timer_rand_state *state)
{
- if (irq >= nr_irqs)
- return;
-
irq_timer_state[irq] = state;
}
+#else
+
+static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
+{
+ struct irq_desc *desc;
+
+ desc = irq_to_desc(irq);
+
+ return desc->timer_rand_state;
+}
+
+static void set_timer_rand_state(unsigned int irq,
+ struct timer_rand_state *state)
+{
+ struct irq_desc *desc;
+
+ desc = irq_to_desc(irq);
+
+ desc->timer_rand_state = state;
+}
+#endif
+
static struct timer_rand_state input_timer_state;
/*
@@ -933,9 +952,6 @@ void rand_initialize_irq(int irq)
{
struct timer_rand_state *state;
- if (irq >= nr_irqs)
- return;
-
state = get_timer_rand_state(irq);
if (state)