From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754942AbYDENwl (ORCPT ); Sat, 5 Apr 2008 09:52:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753773AbYDENvF (ORCPT ); Sat, 5 Apr 2008 09:51:05 -0400 Received: from an-out-0708.google.com ([209.85.132.240]:37199 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752216AbYDENvC (ORCPT ); Sat, 5 Apr 2008 09:51:02 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:user-agent:date:from:to:cc:subject:content-disposition:message-id; b=rkZPV1hEP4ekp2ajitf/CyBCrRoi/4lhbI3kDm79ZrMmdNJPvoe10AQON5c0I+r/im30pYKhK95vnvSEc/rLn59YBWyfw8Yr7/abbHFl2GWe6O/6kn+i+u4yKKJIcDmVswGEP1M9CMpOU7gcvnRfIZdEKXtVq9lTPxHB9nyFEqg= References: <20080405133903.770639386@gmail.com>> User-Agent: quilt/0.46-1 Date: Sat, 05 Apr 2008 22:39:12 +0900 From: Akinobu Mita To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Subject: [patch 9/9] x86: use bitmap library for pin_programmed Content-Disposition: inline; filename=x86-mpparse-use-bitmap.patch Message-ID: <47f783c4.1aad7e0a.12c1.24dc@mx.google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use bitmap library for pin_programmed rather than reinvent bitmaps. Signed-off-by: Akinobu Mita --- arch/x86/kernel/mpparse_32.c | 15 ++++++--------- arch/x86/kernel/mpparse_64.c | 16 +++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) Index: 2.6-git/arch/x86/kernel/mpparse_64.c =================================================================== --- 2.6-git.orig/arch/x86/kernel/mpparse_64.c +++ 2.6-git/arch/x86/kernel/mpparse_64.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -643,7 +644,7 @@ static struct mp_ioapic_routing { int apic_id; int gsi_start; int gsi_end; - u32 pin_programmed[4]; + DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); } mp_ioapic_routing[MAX_IO_APICS]; static int mp_find_ioapic(int gsi) @@ -802,9 +803,8 @@ void __init mp_config_acpi_legacy_irqs(v int mp_register_gsi(u32 gsi, int triggering, int polarity) { - int ioapic = -1; - int ioapic_pin = 0; - int idx, bit = 0; + int ioapic; + int ioapic_pin; if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) return gsi; @@ -826,21 +826,19 @@ int mp_register_gsi(u32 gsi, int trigger * with redundant pin->gsi mappings (but unique PCI devices); * we only program the IOAPIC on the first. */ - bit = ioapic_pin % 32; - idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); - if (idx > 3) { + if (ioapic_pin > MP_MAX_IOAPIC_PIN) { printk(KERN_ERR "Invalid reference to IOAPIC pin " "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); return gsi; } - if ((1<gsi mappings (but unique PCI devices); * we only program the IOAPIC on the first. */ - bit = ioapic_pin % 32; - idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); - if (idx > 3) { + if (ioapic_pin > MP_MAX_IOAPIC_PIN) { printk(KERN_ERR "Invalid reference to IOAPIC pin " "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, ioapic_pin); return gsi; } - if ((1<= 64, use IRQ compression --