From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Dhaval Giani <dhaval@linux.vnet.ibm.com>,
Mike Travis <travis@sgi.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yhlu.kernel@gmail.com>
Subject: [PATCH 03/04] x86: put timer_rand_state pointer into irq_desc
Date: Mon, 4 Aug 2008 03:10:00 -0700 [thread overview]
Message-ID: <1217844601-4298-4-git-send-email-yhlu.kernel@gmail.com> (raw)
In-Reply-To: <1217844601-4298-3-git-send-email-yhlu.kernel@gmail.com>
so could remove timer_rand_state pointer array
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Index: linux-2.6/drivers/char/random.c
===================================================================
--- linux-2.6.orig/drivers/char/random.c
+++ linux-2.6/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;
- if (irq >= nr_irqs || irq_timer_state[irq])
+ desc = get_irq_desc(irq);
+ state = desc->timer_rand_state;
+
+ 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
Index: linux-2.6/include/linux/irq.h
===================================================================
--- linux-2.6.orig/include/linux/irq.h
+++ linux-2.6/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 {
unsigned int 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;
next prev parent reply other threads:[~2008-08-04 10:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 10:09 [PATCH 00/04] dyn_array and nr_irqs support v3 -- addon Yinghai Lu
2008-08-04 10:09 ` [PATCH 01/04] x86_64: use get_irq_desc together with dyn_array Yinghai Lu
2008-08-04 10:09 ` [PATCH 02/04] x86: add get_irq_cfg in io_apic_64.c Yinghai Lu
2008-08-04 10:10 ` Yinghai Lu [this message]
2008-08-04 10:10 ` [PATCH 04/04] x86: put irq_2_pin pointer into irq_cfg - 64bit Yinghai Lu
2008-08-04 15:02 ` [PATCH 02/04] x86: add get_irq_cfg in io_apic_64.c Mike Travis
2008-08-04 18:12 ` Yinghai Lu
2008-08-04 20:27 ` Mike Travis
2008-08-04 19:43 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1217844601-4298-4-git-send-email-yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dhaval@linux.vnet.ibm.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=travis@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox