Skip to content

Commit

Permalink
sparseirq: move set/get_timer_rand_state back to .c
Browse files Browse the repository at this point in the history
those two functions only used in that C file

Signed-off-by: Yinghai Lu <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yinghai Lu authored and torvalds committed Jan 3, 2009
1 parent e9e67a8 commit 2f98357
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 56 deletions.
40 changes: 34 additions & 6 deletions drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,40 @@ struct timer_rand_state {
};

#ifndef CONFIG_SPARSE_IRQ
struct timer_rand_state *irq_timer_state[NR_IRQS];

static struct timer_rand_state *irq_timer_state[NR_IRQS];

static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
{
return irq_timer_state[irq];
}

static void set_timer_rand_state(unsigned int irq,
struct timer_rand_state *state)
{
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;
Expand Down Expand Up @@ -919,11 +952,6 @@ void rand_initialize_irq(int irq)
{
struct timer_rand_state *state;

#ifndef CONFIG_SPARSE_IRQ
if (irq >= nr_irqs)
return;
#endif

state = get_timer_rand_state(irq);

if (state)
Expand Down
50 changes: 0 additions & 50 deletions include/linux/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,56 +45,6 @@ struct rand_pool_info {

extern void rand_initialize_irq(int irq);

struct timer_rand_state;
#ifndef CONFIG_SPARSE_IRQ

extern struct timer_rand_state *irq_timer_state[];

static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq)
{
if (irq >= nr_irqs)
return NULL;

return irq_timer_state[irq];
}

static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
{
if (irq >= nr_irqs)
return;

irq_timer_state[irq] = state;
}

#else

#include <linux/irq.h>
static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);

if (!desc)
return NULL;

return desc->timer_rand_state;
}

static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);

if (!desc)
return;

desc->timer_rand_state = state;
}
#endif


extern void add_input_randomness(unsigned int type, unsigned int code,
unsigned int value);
extern void add_interrupt_randomness(int irq);
Expand Down

0 comments on commit 2f98357

Please sign in to comment.