lkml.org 
[lkml]   [2008]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 36/42] x86_64: introduce irq_cfg_with_new
Date
So could only call that one time, when we call add_irq_2_pin

Singed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic_64.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index fc1c6ba..1466e4b 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -135,7 +135,7 @@ static void __init init_work(void *data)
static struct irq_cfg *irq_cfgx;
DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irq_cfg, PAGE_SIZE, init_work);

-static struct irq_cfg *irq_cfg_without_new(unsigned int irq)
+static struct irq_cfg *irq_cfg(unsigned int irq)
{
struct irq_cfg *cfg;

@@ -155,7 +155,7 @@ static struct irq_cfg *irq_cfg_without_new(unsigned int irq)
return NULL;
}

-static struct irq_cfg *irq_cfg(unsigned int irq)
+static struct irq_cfg *irq_cfg_with_new(unsigned int irq)
{
struct irq_cfg *cfg, *cfg_pri;
int i;
@@ -545,7 +545,8 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin)
struct irq_cfg *cfg;
struct irq_pin_list *entry;

- cfg = irq_cfg(irq);
+ /* first time to refer irq_cfg, so with new */
+ cfg = irq_cfg_with_new(irq);
entry = cfg->irq_2_pin;
if (!entry) {
entry = get_one_free_irq_2_pin();
@@ -1208,13 +1209,15 @@ static int setup_ioapic_entry(int apic, int irq,
static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
int trigger, int polarity)
{
- struct irq_cfg *cfg = irq_cfg(irq);
+ struct irq_cfg *cfg;
struct IO_APIC_route_entry entry;
cpumask_t mask;

if (!IO_APIC_IRQ(irq))
return;

+ cfg = irq_cfg(irq);
+
mask = TARGET_CPUS;
if (assign_irq_vector(irq, mask))
return;
@@ -2490,8 +2493,11 @@ int create_irq(void)
if (platform_legacy_irq(new))
continue;
cfg_new = irq_cfg(new);
- if (cfg_new->vector != 0)
+ if (cfg_new && cfg_new->vector != 0)
continue;
+ /* check if need to create one */
+ if (!cfg_new)
+ cfg_new = irq_cfg_with_new(new);
if (__assign_irq_vector(new, TARGET_CPUS) == 0)
irq = new;
break;
--
1.5.4.5


\
 
 \ /
  Last update: 2008-08-09 00:11    [W:0.160 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site