aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/random.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-10 20:42:53 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-10 20:42:53 -0500
commit506c10f26c481b7f8ef27c1c79290f68989b2e9e (patch)
tree03de82e812f00957aa6276dac2fe51c3358e88d7 /drivers/char/random.c
parente1df957670aef74ffd9a4ad93e6d2c90bf6b4845 (diff)
parentc59765042f53a79a7a65585042ff463b69cb248c (diff)
Merge commit 'v2.6.29-rc1' into perfcounters/core
Conflicts: include/linux/kernel_stat.h
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r--drivers/char/random.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 675076f5fca8..7c13581ca9cd 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -407,7 +407,7 @@ struct entropy_store {
407 /* read-write data: */ 407 /* read-write data: */
408 spinlock_t lock; 408 spinlock_t lock;
409 unsigned add_ptr; 409 unsigned add_ptr;
410 int entropy_count; /* Must at no time exceed ->POOLBITS! */ 410 int entropy_count;
411 int input_rotate; 411 int input_rotate;
412}; 412};
413 413
@@ -558,24 +558,43 @@ struct timer_rand_state {
558 unsigned dont_count_entropy:1; 558 unsigned dont_count_entropy:1;
559}; 559};
560 560
561#ifndef CONFIG_SPARSE_IRQ
562
561static struct timer_rand_state *irq_timer_state[NR_IRQS]; 563static struct timer_rand_state *irq_timer_state[NR_IRQS];
562 564
563static struct timer_rand_state *get_timer_rand_state(unsigned int irq) 565static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
564{ 566{
565 if (irq >= nr_irqs)
566 return NULL;
567
568 return irq_timer_state[irq]; 567 return irq_timer_state[irq];
569} 568}
570 569
571static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) 570static void set_timer_rand_state(unsigned int irq,
571 struct timer_rand_state *state)
572{ 572{
573 if (irq >= nr_irqs)
574 return;
575
576 irq_timer_state[irq] = state; 573 irq_timer_state[irq] = state;
577} 574}
578 575
576#else
577
578static 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
587static 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}
596#endif
597
579static struct timer_rand_state input_timer_state; 598static struct timer_rand_state input_timer_state;
580 599
581/* 600/*
@@ -748,11 +767,10 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
748{ 767{
749 unsigned long flags; 768 unsigned long flags;
750 769
751 BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
752
753 /* Hold lock while accounting */ 770 /* Hold lock while accounting */
754 spin_lock_irqsave(&r->lock, flags); 771 spin_lock_irqsave(&r->lock, flags);
755 772
773 BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
756 DEBUG_ENT("trying to extract %d bits from %s\n", 774 DEBUG_ENT("trying to extract %d bits from %s\n",
757 nbytes * 8, r->name); 775 nbytes * 8, r->name);
758 776
@@ -933,9 +951,6 @@ void rand_initialize_irq(int irq)
933{ 951{
934 struct timer_rand_state *state; 952 struct timer_rand_state *state;
935 953
936 if (irq >= nr_irqs)
937 return;
938
939 state = get_timer_rand_state(irq); 954 state = get_timer_rand_state(irq);
940 955
941 if (state) 956 if (state)