diff options
-rw-r--r-- | drivers/char/random.c | 40 | ||||
-rw-r--r-- | include/linux/random.h | 50 |
2 files changed, 34 insertions, 56 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index d26891bfcd41..c7afc068c28d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -559,7 +559,40 @@ struct timer_rand_state { | |||
559 | }; | 559 | }; |
560 | 560 | ||
561 | #ifndef CONFIG_SPARSE_IRQ | 561 | #ifndef CONFIG_SPARSE_IRQ |
562 | struct timer_rand_state *irq_timer_state[NR_IRQS]; | 562 | |
563 | static struct timer_rand_state *irq_timer_state[NR_IRQS]; | ||
564 | |||
565 | static struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
566 | { | ||
567 | return irq_timer_state[irq]; | ||
568 | } | ||
569 | |||
570 | static void set_timer_rand_state(unsigned int irq, | ||
571 | struct timer_rand_state *state) | ||
572 | { | ||
573 | irq_timer_state[irq] = state; | ||
574 | } | ||
575 | |||
576 | #else | ||
577 | |||
578 | static struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
579 | { | ||
580 | struct irq_desc *desc; | ||
581 | |||
582 | desc = irq_to_desc(irq); | ||
583 | |||
584 | return desc->timer_rand_state; | ||
585 | } | ||
586 | |||
587 | static void set_timer_rand_state(unsigned int irq, | ||
588 | struct timer_rand_state *state) | ||
589 | { | ||
590 | struct irq_desc *desc; | ||
591 | |||
592 | desc = irq_to_desc(irq); | ||
593 | |||
594 | desc->timer_rand_state = state; | ||
595 | } | ||
563 | #endif | 596 | #endif |
564 | 597 | ||
565 | static struct timer_rand_state input_timer_state; | 598 | static struct timer_rand_state input_timer_state; |
@@ -919,11 +952,6 @@ void rand_initialize_irq(int irq) | |||
919 | { | 952 | { |
920 | struct timer_rand_state *state; | 953 | struct timer_rand_state *state; |
921 | 954 | ||
922 | #ifndef CONFIG_SPARSE_IRQ | ||
923 | if (irq >= nr_irqs) | ||
924 | return; | ||
925 | #endif | ||
926 | |||
927 | state = get_timer_rand_state(irq); | 955 | state = get_timer_rand_state(irq); |
928 | 956 | ||
929 | if (state) | 957 | if (state) |
diff --git a/include/linux/random.h b/include/linux/random.h index adbf3bd3c6b3..407ea3646f8f 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -45,56 +45,6 @@ struct rand_pool_info { | |||
45 | 45 | ||
46 | extern void rand_initialize_irq(int irq); | 46 | extern void rand_initialize_irq(int irq); |
47 | 47 | ||
48 | struct timer_rand_state; | ||
49 | #ifndef CONFIG_SPARSE_IRQ | ||
50 | |||
51 | extern struct timer_rand_state *irq_timer_state[]; | ||
52 | |||
53 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
54 | { | ||
55 | if (irq >= nr_irqs) | ||
56 | return NULL; | ||
57 | |||
58 | return irq_timer_state[irq]; | ||
59 | } | ||
60 | |||
61 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
62 | { | ||
63 | if (irq >= nr_irqs) | ||
64 | return; | ||
65 | |||
66 | irq_timer_state[irq] = state; | ||
67 | } | ||
68 | |||
69 | #else | ||
70 | |||
71 | #include <linux/irq.h> | ||
72 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
73 | { | ||
74 | struct irq_desc *desc; | ||
75 | |||
76 | desc = irq_to_desc(irq); | ||
77 | |||
78 | if (!desc) | ||
79 | return NULL; | ||
80 | |||
81 | return desc->timer_rand_state; | ||
82 | } | ||
83 | |||
84 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
85 | { | ||
86 | struct irq_desc *desc; | ||
87 | |||
88 | desc = irq_to_desc(irq); | ||
89 | |||
90 | if (!desc) | ||
91 | return; | ||
92 | |||
93 | desc->timer_rand_state = state; | ||
94 | } | ||
95 | #endif | ||
96 | |||
97 | |||
98 | extern void add_input_randomness(unsigned int type, unsigned int code, | 48 | extern void add_input_randomness(unsigned int type, unsigned int code, |
99 | unsigned int value); | 49 | unsigned int value); |
100 | extern void add_interrupt_randomness(int irq); | 50 | extern void add_interrupt_randomness(int irq); |