* [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs
@ 2008-06-16 1:19 Yinghai Lu
2008-06-16 7:53 ` Ingo Molnar
2008-06-16 13:10 ` Alexey Starikovskiy
0 siblings, 2 replies; 3+ messages in thread
From: Yinghai Lu @ 2008-06-16 1:19 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
so don't get that same value multiple times.
also make mp_config_acpi_legacy_irqs more readable by moving some assignment
together.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d2a4768..04dbb35 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -960,8 +960,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
{
- int ioapic = -1;
- int pin = -1;
+ int ioapic;
+ int pin;
/*
* Convert 'gsi' to 'ioapic.pin'.
@@ -995,8 +995,9 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
void __init mp_config_acpi_legacy_irqs(void)
{
- int i = 0;
- int ioapic = -1;
+ int i;
+ int ioapic;
+ unsigned int dstapic;
#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
/*
@@ -1021,6 +1022,7 @@ void __init mp_config_acpi_legacy_irqs(void)
ioapic = mp_find_ioapic(0);
if (ioapic < 0)
return;
+ dstapic = mp_ioapics[ioapic].mp_apicid;
/*
* Use the default configuration for the IRQs 0-15. Unless
@@ -1029,11 +1031,6 @@ void __init mp_config_acpi_legacy_irqs(void)
for (i = 0; i < 16; i++) {
int idx;
- mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
- mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
- mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
- mp_irqs[mp_irq_entries].mp_dstapic = mp_ioapics[ioapic].mp_apicid;
-
for (idx = 0; idx < mp_irq_entries; idx++) {
struct mp_config_intsrc *irq = mp_irqs + idx;
@@ -1043,9 +1040,8 @@ void __init mp_config_acpi_legacy_irqs(void)
break;
/* Do we already have a mapping for this IOAPIC pin */
- if ((irq->mp_dstapic ==
- mp_irqs[mp_irq_entries].mp_dstapic) &&
- (irq->mp_dstirq == i))
+ if (irq->mp_dstapic == dstapic &&
+ irq->mp_dstirq == i)
break;
}
@@ -1054,8 +1050,12 @@ void __init mp_config_acpi_legacy_irqs(void)
continue; /* IRQ already used */
}
+ mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
+ mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
+ mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
+ mp_irqs[mp_irq_entries].mp_dstapic = dstapic;
mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
- mp_irqs[mp_irq_entries].mp_srcbusirq = i; /* Identity mapped */
+ mp_irqs[mp_irq_entries].mp_srcbusirq = i; /* Identity mapped */
mp_irqs[mp_irq_entries].mp_dstirq = i;
if (++mp_irq_entries == MAX_IRQ_SOURCES)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs
2008-06-16 1:19 [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs Yinghai Lu
@ 2008-06-16 7:53 ` Ingo Molnar
2008-06-16 13:10 ` Alexey Starikovskiy
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-06-16 7:53 UTC (permalink / raw)
To: Yinghai Lu
Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org
* Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> so don't get that same value multiple times.
>
> also make mp_config_acpi_legacy_irqs more readable by moving some
> assignment together.
applied to tip/x86/mpparse - thanks Yinghai.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs
2008-06-16 1:19 [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs Yinghai Lu
2008-06-16 7:53 ` Ingo Molnar
@ 2008-06-16 13:10 ` Alexey Starikovskiy
1 sibling, 0 replies; 3+ messages in thread
From: Alexey Starikovskiy @ 2008-06-16 13:10 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
linux-kernel@vger.kernel.org
Hi Yinghai,
I think it should be split into 3 pieces, according to latest tradition :)
1. don't init variables with -1
2. use dstapic to allow moving of assignments together
3. move assignments
Other than that seems ok (thou I'm not sure that -1 is not used somewhere)
Regards,
Alex.
Yinghai Lu wrote:
> so don't get that same value multiple times.
>
> also make mp_config_acpi_legacy_irqs more readable by moving some assignment
> together.
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index d2a4768..04dbb35 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -960,8 +960,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
>
> void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
> {
> - int ioapic = -1;
> - int pin = -1;
> + int ioapic;
> + int pin;
>
> /*
> * Convert 'gsi' to 'ioapic.pin'.
> @@ -995,8 +995,9 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
>
> void __init mp_config_acpi_legacy_irqs(void)
> {
> - int i = 0;
> - int ioapic = -1;
> + int i;
> + int ioapic;
> + unsigned int dstapic;
>
> #if defined (CONFIG_MCA) || defined (CONFIG_EISA)
> /*
> @@ -1021,6 +1022,7 @@ void __init mp_config_acpi_legacy_irqs(void)
> ioapic = mp_find_ioapic(0);
> if (ioapic < 0)
> return;
> + dstapic = mp_ioapics[ioapic].mp_apicid;
>
> /*
> * Use the default configuration for the IRQs 0-15. Unless
> @@ -1029,11 +1031,6 @@ void __init mp_config_acpi_legacy_irqs(void)
> for (i = 0; i < 16; i++) {
> int idx;
>
> - mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
> - mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
> - mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
> - mp_irqs[mp_irq_entries].mp_dstapic = mp_ioapics[ioapic].mp_apicid;
> -
> for (idx = 0; idx < mp_irq_entries; idx++) {
> struct mp_config_intsrc *irq = mp_irqs + idx;
>
> @@ -1043,9 +1040,8 @@ void __init mp_config_acpi_legacy_irqs(void)
> break;
>
> /* Do we already have a mapping for this IOAPIC pin */
> - if ((irq->mp_dstapic ==
> - mp_irqs[mp_irq_entries].mp_dstapic) &&
> - (irq->mp_dstirq == i))
> + if (irq->mp_dstapic == dstapic &&
> + irq->mp_dstirq == i)
> break;
> }
>
> @@ -1054,8 +1050,12 @@ void __init mp_config_acpi_legacy_irqs(void)
> continue; /* IRQ already used */
> }
>
> + mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
> + mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
> + mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
> + mp_irqs[mp_irq_entries].mp_dstapic = dstapic;
> mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
> - mp_irqs[mp_irq_entries].mp_srcbusirq = i; /* Identity mapped */
> + mp_irqs[mp_irq_entries].mp_srcbusirq = i; /* Identity mapped */
> mp_irqs[mp_irq_entries].mp_dstirq = i;
>
> if (++mp_irq_entries == MAX_IRQ_SOURCES)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-16 13:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 1:19 [PATCH] x86: using dstapic in mp_config_acpi_legacy_irqs Yinghai Lu
2008-06-16 7:53 ` Ingo Molnar
2008-06-16 13:10 ` Alexey Starikovskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox