lkml.org 
[lkml]   [2008]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 29/33] x86: put timer_rand_state pointer into irq_desc
    Date
    so could remove timer_rand_state pointer array

    Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
    ---
    drivers/char/random.c | 31 ++++++++++++++++++++-----------
    include/linux/irq.h | 2 ++
    2 files changed, 22 insertions(+), 11 deletions(-)

    diff --git a/drivers/char/random.c b/drivers/char/random.c
    index 872669e..d9e7a08 100644
    --- a/drivers/char/random.c
    +++ b/drivers/char/random.c
    @@ -559,13 +559,6 @@ struct timer_rand_state {

    static struct timer_rand_state input_timer_state;

    -#ifdef CONFIG_HAVE_DYN_ARRAY
    -static struct timer_rand_state **irq_timer_state;
    -DEFINE_DYN_ARRAY(irq_timer_state, sizeof(struct timer_rand_state *), nr_irqs, PAGE_SIZE, NULL);
    -#else
    -static struct timer_rand_state *irq_timer_state[NR_IRQS];
    -#endif
    -
    /*
    * This function adds entropy to the entropy "pool" by using timing
    * delays. It uses the timer_rand_state structure to make an estimate
    @@ -653,11 +646,20 @@ EXPORT_SYMBOL_GPL(add_input_randomness);

    void add_interrupt_randomness(int irq)
    {
    - if (irq >= nr_irqs || irq_timer_state[irq] == NULL)
    + struct timer_rand_state *state;
    + struct irq_desc *desc;
    +
    + if (irq >= nr_irqs)
    + return;
    +
    + desc = get_irq_desc(irq);
    + state = desc->timer_rand_state;
    +
    + if (state == NULL)
    return;

    DEBUG_ENT("irq event %d\n", irq);
    - add_timer_randomness(irq_timer_state[irq], 0x100 + irq);
    + add_timer_randomness(state, 0x100 + irq);
    }

    #ifdef CONFIG_BLOCK
    @@ -916,8 +918,15 @@ module_init(rand_initialize);
    void rand_initialize_irq(int irq)
    {
    struct timer_rand_state *state;
    + struct irq_desc *desc;
    +
    + if (irq >= nr_irqs)
    + return;
    +
    + desc = get_irq_desc(irq);
    + state = desc->timer_rand_state;

    - if (irq >= nr_irqs || irq_timer_state[irq])
    + if (state)
    return;

    /*
    @@ -926,7 +935,7 @@ void rand_initialize_irq(int irq)
    */
    state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
    if (state)
    - irq_timer_state[irq] = state;
    + desc->timer_rand_state = state;
    }

    #ifdef CONFIG_BLOCK
    diff --git a/include/linux/irq.h b/include/linux/irq.h
    index aaf2029..3abdf48 100644
    --- a/include/linux/irq.h
    +++ b/include/linux/irq.h
    @@ -129,6 +129,7 @@ struct irq_chip {
    const char *typename;
    };

    +struct timer_rand_state;
    /**
    * struct irq_desc - interrupt descriptor
    *
    @@ -158,6 +159,7 @@ struct irq_desc {
    #ifdef CONFIG_HAVE_SPARSE_IRQ
    struct irq_desc *next;
    #endif
    + struct timer_rand_state *timer_rand_state;
    irq_flow_handler_t handle_irq;
    struct irq_chip *chip;
    struct msi_desc *msi_desc;
    --
    1.5.4.5


    \
     
     \ /
      Last update: 2008-08-06 11:05    [W:0.072 / U:1.648 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site