aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2012-07-14 20:27:52 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-07-19 10:38:32 -0400
commitc5857ccf293968348e5eb4ebedc68074de3dcda6 (patch)
tree33b74f247459881a9dfdaafd6eb2756c3894521a
parent27130f0cc3ab97560384da437e4621fc4e94f21c (diff)
random: remove rand_initialize_irq()
With the new interrupt sampling system, we are no longer using the timer_rand_state structure in the irq descriptor, so we can stop initializing it now. [ Merged in fixes from Sedat to find some last missing references to rand_initialize_irq() ] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
-rw-r--r--arch/ia64/kernel/irq_ia64.c1
-rw-r--r--drivers/char/random.c55
-rw-r--r--drivers/mfd/ab3100-core.c3
-rw-r--r--include/linux/irqdesc.h1
-rw-r--r--include/linux/random.h2
-rw-r--r--kernel/irq/manage.c17
6 files changed, 0 insertions, 79 deletions
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 5c3e0888265a..1034884b77da 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -23,7 +23,6 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/kernel_stat.h> 24#include <linux/kernel_stat.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/random.h> /* for rand_initialize_irq() */
27#include <linux/signal.h> 26#include <linux/signal.h>
28#include <linux/smp.h> 27#include <linux/smp.h>
29#include <linux/threads.h> 28#include <linux/threads.h>
diff --git a/drivers/char/random.c b/drivers/char/random.c
index e3180852ec85..9793b40f5754 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -634,43 +634,6 @@ struct timer_rand_state {
634 unsigned dont_count_entropy:1; 634 unsigned dont_count_entropy:1;
635}; 635};
636 636
637#ifndef CONFIG_GENERIC_HARDIRQS
638
639static struct timer_rand_state *irq_timer_state[NR_IRQS];
640
641static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
642{
643 return irq_timer_state[irq];
644}
645
646static void set_timer_rand_state(unsigned int irq,
647 struct timer_rand_state *state)
648{
649 irq_timer_state[irq] = state;
650}
651
652#else
653
654static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
655{
656 struct irq_desc *desc;
657
658 desc = irq_to_desc(irq);
659
660 return desc->timer_rand_state;
661}
662
663static void set_timer_rand_state(unsigned int irq,
664 struct timer_rand_state *state)
665{
666 struct irq_desc *desc;
667
668 desc = irq_to_desc(irq);
669
670 desc->timer_rand_state = state;
671}
672#endif
673
674/* 637/*
675 * Add device- or boot-specific data to the input and nonblocking 638 * Add device- or boot-specific data to the input and nonblocking
676 * pools to help initialize them to unique values. 639 * pools to help initialize them to unique values.
@@ -1133,24 +1096,6 @@ static int rand_initialize(void)
1133} 1096}
1134module_init(rand_initialize); 1097module_init(rand_initialize);
1135 1098
1136void rand_initialize_irq(int irq)
1137{
1138 struct timer_rand_state *state;
1139
1140 state = get_timer_rand_state(irq);
1141
1142 if (state)
1143 return;
1144
1145 /*
1146 * If kzalloc returns null, we just won't use that entropy
1147 * source.
1148 */
1149 state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
1150 if (state)
1151 set_timer_rand_state(irq, state);
1152}
1153
1154#ifdef CONFIG_BLOCK 1099#ifdef CONFIG_BLOCK
1155void rand_initialize_disk(struct gendisk *disk) 1100void rand_initialize_disk(struct gendisk *disk)
1156{ 1101{
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 9522d6bda4f7..1287645b984d 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -931,9 +931,6 @@ static int __devinit ab3100_probe(struct i2c_client *client,
931 931
932 err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler, 932 err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler,
933 IRQF_ONESHOT, "ab3100-core", ab3100); 933 IRQF_ONESHOT, "ab3100-core", ab3100);
934 /* This real unpredictable IRQ is of course sampled for entropy */
935 rand_initialize_irq(client->irq);
936
937 if (err) 934 if (err)
938 goto exit_no_irq; 935 goto exit_no_irq;
939 936
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index f1e2527006bd..9a323d12de1c 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -39,7 +39,6 @@ struct module;
39 */ 39 */
40struct irq_desc { 40struct irq_desc {
41 struct irq_data irq_data; 41 struct irq_data irq_data;
42 struct timer_rand_state *timer_rand_state;
43 unsigned int __percpu *kstat_irqs; 42 unsigned int __percpu *kstat_irqs;
44 irq_flow_handler_t handle_irq; 43 irq_flow_handler_t handle_irq;
45#ifdef CONFIG_IRQ_PREFLOW_FASTEOI 44#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
diff --git a/include/linux/random.h b/include/linux/random.h
index 29e217a7e6d0..ac621ce886ca 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -48,8 +48,6 @@ struct rnd_state {
48 48
49#ifdef __KERNEL__ 49#ifdef __KERNEL__
50 50
51extern void rand_initialize_irq(int irq);
52
53extern void add_device_randomness(const void *, unsigned int); 51extern void add_device_randomness(const void *, unsigned int);
54extern void add_input_randomness(unsigned int type, unsigned int code, 52extern void add_input_randomness(unsigned int type, unsigned int code,
55 unsigned int value); 53 unsigned int value);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 8c548232ba39..5e42eb119677 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -893,22 +893,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
893 return -ENOSYS; 893 return -ENOSYS;
894 if (!try_module_get(desc->owner)) 894 if (!try_module_get(desc->owner))
895 return -ENODEV; 895 return -ENODEV;
896 /*
897 * Some drivers like serial.c use request_irq() heavily,
898 * so we have to be careful not to interfere with a
899 * running system.
900 */
901 if (new->flags & IRQF_SAMPLE_RANDOM) {
902 /*
903 * This function might sleep, we want to call it first,
904 * outside of the atomic block.
905 * Yes, this might clear the entropy pool if the wrong
906 * driver is attempted to be loaded, without actually
907 * installing a new handler, but is this really a problem,
908 * only the sysadmin is able to do this.
909 */
910 rand_initialize_irq(irq);
911 }
912 896
913 /* 897 /*
914 * Check whether the interrupt nests into another interrupt 898 * Check whether the interrupt nests into another interrupt
@@ -1354,7 +1338,6 @@ EXPORT_SYMBOL(free_irq);
1354 * Flags: 1338 * Flags:
1355 * 1339 *
1356 * IRQF_SHARED Interrupt is shared 1340 * IRQF_SHARED Interrupt is shared
1357 * IRQF_SAMPLE_RANDOM The interrupt can be used for entropy
1358 * IRQF_TRIGGER_* Specify active edge(s) or level 1341 * IRQF_TRIGGER_* Specify active edge(s) or level
1359 * 1342 *
1360 */ 1343 */