]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 20:22:50 +0000 (13:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 20 Oct 2008 20:23:01 +0000 (13:23 -0700)
This merges branches irq/genirq, irq/sparseirq-v4, timers/hpet-percpu
and x86/uv.

The sparseirq branch is just preliminary groundwork: no sparse IRQs are
actually implemented by this tree anymore - just the new APIs are added
while keeping the old way intact as well (the new APIs map 1:1 to
irq_desc[]).  The 'real' sparse IRQ support will then be a relatively
small patch ontop of this - with a v2.6.29 merge target.

* 'genirq-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (178 commits)
  genirq: improve include files
  intr_remapping: fix typo
  io_apic: make irq_mis_count available on 64-bit too
  genirq: fix name space collisions of nr_irqs in arch/*
  genirq: fix name space collision of nr_irqs in autoprobe.c
  genirq: use iterators for irq_desc loops
  proc: fixup irq iterator
  genirq: add reverse iterator for irq_desc
  x86: move ack_bad_irq() to irq.c
  x86: unify show_interrupts() and proc helpers
  x86: cleanup show_interrupts
  genirq: cleanup the sparseirq modifications
  genirq: remove artifacts from sparseirq removal
  genirq: revert dynarray
  genirq: remove irq_to_desc_alloc
  genirq: remove sparse irq code
  genirq: use inline function for irq_to_desc
  genirq: consolidate nr_irqs and for_each_irq_desc()
  x86: remove sparse irq from Kconfig
  genirq: define nr_irqs for architectures with GENERIC_HARDIRQS=n
  ...

19 files changed:
1  2 
arch/arm/mach-omap2/irq.c
arch/x86/Kconfig
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c
drivers/char/random.c
drivers/gpio/gpiolib.c
drivers/mfd/htc-egpio.c
drivers/pci/dmar.c
drivers/pci/intr_remapping.c
drivers/serial/8250.c
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/serial/sh-sci.c
drivers/serial/ucc_uart.c
fs/proc/proc_misc.c
include/asm-x86/es7000/apic.h
include/asm-x86/summit/apic.h
include/linux/interrupt.h
include/linux/kernel_stat.h
include/linux/pci.h

index d354e0fe4477ad450668b16e462258e26b2b4853,003901f1e2da045e45060dfaa067c2b84e58d171..c40fc378a251244bce6e6c0ad9f0e177c7326a75
  #include <linux/io.h>
  #include <mach/hardware.h>
  #include <asm/mach/irq.h>
 -#include <asm/irq.h>
  
 -#define INTC_REVISION 0x0000
 -#define INTC_SYSCONFIG        0x0010
 -#define INTC_SYSSTATUS        0x0014
 -#define INTC_CONTROL  0x0048
 -#define INTC_MIR_CLEAR0       0x0088
 -#define INTC_MIR_SET0 0x008c
 +
 +/* selected INTC register offsets */
 +
 +#define INTC_REVISION         0x0000
 +#define INTC_SYSCONFIG                0x0010
 +#define INTC_SYSSTATUS                0x0014
 +#define INTC_CONTROL          0x0048
 +#define INTC_MIR_CLEAR0               0x0088
 +#define INTC_MIR_SET0         0x008c
 +#define INTC_PENDING_IRQ0     0x0098
 +
 +/* Number of IRQ state bits in each MIR register */
 +#define IRQ_BITS_PER_REG      32
  
  /*
   * OMAP2 has a number of different interrupt controllers, each interrupt
   * for each bank.. when in doubt, consult the TRM.
   */
  static struct omap_irq_bank {
 -      unsigned long base_reg;
 +      void __iomem *base_reg;
        unsigned int nr_irqs;
  } __attribute__ ((aligned(4))) irq_banks[] = {
        {
                /* MPU INTC */
 -              .base_reg       = IO_ADDRESS(OMAP24XX_IC_BASE),
 +              .base_reg       = 0,
                .nr_irqs        = 96,
 -      }, {
 -              /* XXX: DSP INTC */
 -      }
 +      },
  };
  
 +/* INTC bank register get/set */
 +
 +static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
 +{
 +      __raw_writel(val, bank->base_reg + reg);
 +}
 +
 +static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
 +{
 +      return __raw_readl(bank->base_reg + reg);
 +}
 +
  /* XXX: FIQ and additional INTC support (only MPU at the moment) */
  static void omap_ack_irq(unsigned int irq)
  {
 -      __raw_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL);
 +      intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL);
  }
  
  static void omap_mask_irq(unsigned int irq)
  {
 -      int offset = (irq >> 5) << 5;
 +      int offset = irq & (~(IRQ_BITS_PER_REG - 1));
  
 -      if (irq >= 64) {
 -              irq %= 64;
 -      } else if (irq >= 32) {
 -              irq %= 32;
 -      }
 +      irq &= (IRQ_BITS_PER_REG - 1);
  
 -      __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset);
 +      intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset);
  }
  
  static void omap_unmask_irq(unsigned int irq)
  {
 -      int offset = (irq >> 5) << 5;
 +      int offset = irq & (~(IRQ_BITS_PER_REG - 1));
  
 -      if (irq >= 64) {
 -              irq %= 64;
 -      } else if (irq >= 32) {
 -              irq %= 32;
 -      }
 +      irq &= (IRQ_BITS_PER_REG - 1);
  
 -      __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset);
 +      intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset);
  }
  
  static void omap_mask_ack_irq(unsigned int irq)
@@@ -101,46 -93,45 +101,46 @@@ static void __init omap_irq_bank_init_o
  {
        unsigned long tmp;
  
 -      tmp = __raw_readl(bank->base_reg + INTC_REVISION) & 0xff;
 -      printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx "
 +      tmp = intc_bank_read_reg(bank, INTC_REVISION) & 0xff;
 +      printk(KERN_INFO "IRQ: Found an INTC at 0x%p "
                         "(revision %ld.%ld) with %d interrupts\n",
                         bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
  
 -      tmp = __raw_readl(bank->base_reg + INTC_SYSCONFIG);
 +      tmp = intc_bank_read_reg(bank, INTC_SYSCONFIG);
        tmp |= 1 << 1;  /* soft reset */
 -      __raw_writel(tmp, bank->base_reg + INTC_SYSCONFIG);
 +      intc_bank_write_reg(tmp, bank, INTC_SYSCONFIG);
  
 -      while (!(__raw_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1))
 +      while (!(intc_bank_read_reg(bank, INTC_SYSSTATUS) & 0x1))
                /* Wait for reset to complete */;
  
        /* Enable autoidle */
 -      __raw_writel(1 << 0, bank->base_reg + INTC_SYSCONFIG);
 +      intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG);
  }
  
  void __init omap_init_irq(void)
  {
-       unsigned long nr_irqs = 0;
+       unsigned long nr_of_irqs = 0;
        unsigned int nr_banks = 0;
        int i;
  
        for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
                struct omap_irq_bank *bank = irq_banks + i;
  
 -              /* XXX */
 -              if (!bank->base_reg)
 -                      continue;
 +              if (cpu_is_omap24xx())
 +                      bank->base_reg = OMAP2_IO_ADDRESS(OMAP24XX_IC_BASE);
 +              else if (cpu_is_omap34xx())
 +                      bank->base_reg = OMAP2_IO_ADDRESS(OMAP34XX_IC_BASE);
  
                omap_irq_bank_init_one(bank);
  
-               nr_irqs += bank->nr_irqs;
+               nr_of_irqs += bank->nr_irqs;
                nr_banks++;
        }
  
        printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n",
-              nr_irqs, nr_banks, nr_banks > 1 ? "s" : "");
+              nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
  
-       for (i = 0; i < nr_irqs; i++) {
+       for (i = 0; i < nr_of_irqs; i++) {
                set_irq_chip(i, &omap_irq_chip);
                set_irq_handler(i, handle_level_irq);
                set_irq_flags(i, IRQF_VALID);
diff --combined arch/x86/Kconfig
index 49349ba77d80b81141deb6065510e54fc74eb077,8da6123a60d0ead555429e138e039129b5ec1cd4..739668968390ab0d2bcb49d4433a8a0d19f68838
@@@ -39,6 -39,10 +39,6 @@@ config ARCH_DEFCONFI
        default "arch/x86/configs/i386_defconfig" if X86_32
        default "arch/x86/configs/x86_64_defconfig" if X86_64
  
 -
 -config GENERIC_LOCKBREAK
 -      def_bool n
 -
  config GENERIC_TIME
        def_bool y
  
@@@ -91,7 -95,7 +91,7 @@@ config GENERIC_HWEIGH
        def_bool y
  
  config GENERIC_GPIO
 -      def_bool n
 +      bool
  
  config ARCH_MAY_HAVE_PC_FDC
        def_bool y
@@@ -102,6 -106,12 +102,6 @@@ config RWSEM_GENERIC_SPINLOC
  config RWSEM_XCHGADD_ALGORITHM
        def_bool X86_XADD
  
 -config ARCH_HAS_ILOG2_U32
 -      def_bool n
 -
 -config ARCH_HAS_ILOG2_U64
 -      def_bool n
 -
  config ARCH_HAS_CPU_IDLE_WAIT
        def_bool y
  
@@@ -193,7 -203,6 +193,7 @@@ config X86_TRAMPOLIN
  config KTIME_SCALAR
        def_bool X86_32
  source "init/Kconfig"
 +source "kernel/Kconfig.freezer"
  
  menu "Processor type and features"
  
@@@ -749,8 -758,9 +749,8 @@@ config I8
          Say N otherwise.
  
  config X86_REBOOTFIXUPS
 -      def_bool n
 -      prompt "Enable X86 board specific fixups for reboot"
 -      depends on X86_32 && X86
 +      bool "Enable X86 board specific fixups for reboot"
 +      depends on X86_32
        ---help---
          This enables chipset and/or board specific fixups to be done
          in order to get reboot to work correctly. This is only needed on
@@@ -934,17 -944,16 +934,17 @@@ config HIGHME
        depends on X86_32 && (HIGHMEM64G || HIGHMEM4G)
  
  config X86_PAE
 -      def_bool n
 -      prompt "PAE (Physical Address Extension) Support"
 +      bool "PAE (Physical Address Extension) Support"
        depends on X86_32 && !HIGHMEM4G
 -      select RESOURCES_64BIT
        help
          PAE is required for NX support, and furthermore enables
          larger swapspace support for non-overcommit purposes. It
          has the cost of more pagetable lookup overhead, and also
          consumes more pagetable space per process.
  
 +config ARCH_PHYS_ADDR_T_64BIT
 +       def_bool X86_64 || X86_PAE
 +
  # Common NUMA Features
  config NUMA
        bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
@@@ -1229,7 -1238,8 +1229,7 @@@ config X86_PA
          If unsure, say Y.
  
  config EFI
 -      def_bool n
 -      prompt "EFI runtime service support"
 +      bool "EFI runtime service support"
        depends on ACPI
        ---help---
        This enables the kernel to use EFI runtime services that are
        resultant kernel should continue to boot on existing non-EFI
        platforms.
  
- config IRQBALANCE
-       def_bool y
-       prompt "Enable kernel irq balancing"
-       depends on X86_32 && SMP && X86_IO_APIC
-       help
-         The default yes will allow the kernel to do irq load balancing.
-         Saying no will keep the kernel from doing irq load balancing.
  config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
diff --combined arch/x86/kernel/setup.c
index b2c97874ec0f95f7cfbea51b7b7695a2939c1b01,61335306696ab05b22fd66cdfe6e5cf70ca7216f..0fa6790c1dd37d76e257de661ba3ed9312de89e0
@@@ -561,13 -561,7 +561,13 @@@ static void __init reserve_standard_io_
  
  }
  
 -#ifdef CONFIG_PROC_VMCORE
 +/*
 + * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
 + * is_kdump_kernel() to determine if we are booting after a panic. Hence
 + * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
 + */
 +
 +#ifdef CONFIG_CRASH_DUMP
  /* elfcorehdr= specifies the location of elf core header
   * stored by the crashed kernel. This option will be passed
   * by kexec loader to the capture kernel.
@@@ -1073,6 -1067,7 +1073,7 @@@ void __init setup_arch(char **cmdline_p
  #endif
  
        prefill_possible_map();
  #ifdef CONFIG_X86_64
        init_cpu_to_node();
  #endif
        init_apic_mappings();
        ioapic_init_mappings();
  
+       /* need to wait for io_apic is mapped */
+       nr_irqs = probe_nr_irqs();
        kvm_guest_init();
  
        e820_reserve_resources();
index 7ed9e070a6e930d97e2d55c8750a50f57a9baef1,f84de2ff933cf2d9dca59b679b82eb247bed567a..7ece815ea637497355a63ba90b218ef5536d57a0
@@@ -282,8 -282,6 +282,8 @@@ static void __cpuinit smp_callin(void
        cpu_set(cpuid, cpu_callin_map);
  }
  
 +static int __cpuinitdata unsafe_smp;
 +
  /*
   * Activate a secondary processor.
   */
@@@ -399,7 -397,7 +399,7 @@@ static void __cpuinit smp_apply_quirks(
                                goto valid_k7;
  
                /* If we get here, not a certified SMP capable AMD system. */
 -              add_taint(TAINT_UNSAFE_SMP);
 +              unsafe_smp = 1;
        }
  
  valid_k7:
@@@ -416,10 -414,12 +416,10 @@@ static void __cpuinit smp_checks(void
         * Don't taint if we are running SMP kernel on a single non-MP
         * approved Athlon
         */
 -      if (tainted & TAINT_UNSAFE_SMP) {
 -              if (num_online_cpus())
 -                      printk(KERN_INFO "WARNING: This combination of AMD"
 -                              "processors is not suitable for SMP.\n");
 -              else
 -                      tainted &= ~TAINT_UNSAFE_SMP;
 +      if (unsafe_smp && num_online_cpus() > 1) {
 +              printk(KERN_INFO "WARNING: This combination of AMD"
 +                      "processors is not suitable for SMP.\n");
 +              add_taint(TAINT_UNSAFE_SMP);
        }
  }
  
@@@ -543,10 -543,10 +543,10 @@@ static inline void __inquire_remote_api
        int timeout;
        u32 status;
  
-       printk(KERN_INFO "Inquiring remote APIC #%d...\n", apicid);
+       printk(KERN_INFO "Inquiring remote APIC 0x%x...\n", apicid);
  
        for (i = 0; i < ARRAY_SIZE(regs); i++) {
-               printk(KERN_INFO "... APIC #%d %s: ", apicid, names[i]);
+               printk(KERN_INFO "... APIC 0x%x %s: ", apicid, names[i]);
  
                /*
                 * Wait for idle.
@@@ -874,7 -874,7 +874,7 @@@ do_rest
        start_ip = setup_trampoline();
  
        /* So we see what's up   */
-       printk(KERN_INFO "Booting processor %d/%d ip %lx\n",
+       printk(KERN_INFO "Booting processor %d APIC 0x%x ip 0x%lx\n",
                          cpu, apicid, start_ip);
  
        /*
diff --combined drivers/char/random.c
index c8752eaad483eea52b4dbc8c8af87eaf931ad189,1137d2976043d0329867a129558fbb10a792e89a..705a839f1796125b257925dc8c3aac722d992018
@@@ -558,9 -558,26 +558,26 @@@ struct timer_rand_state 
        unsigned dont_count_entropy:1;
  };
  
- static struct timer_rand_state input_timer_state;
  static struct timer_rand_state *irq_timer_state[NR_IRQS];
  
+ static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
+ {
+       if (irq >= nr_irqs)
+               return NULL;
+       return irq_timer_state[irq];
+ }
+ static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
+ {
+       if (irq >= nr_irqs)
+               return;
+       irq_timer_state[irq] = state;
+ }
+ static struct timer_rand_state input_timer_state;
  /*
   * This function adds entropy to the entropy "pool" by using timing
   * delays.  It uses the timer_rand_state structure to make an estimate
@@@ -648,11 -665,15 +665,15 @@@ 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;
+       state = get_timer_rand_state(irq);
+       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
@@@ -912,7 -933,12 +933,12 @@@ void rand_initialize_irq(int irq
  {
        struct timer_rand_state *state;
  
-       if (irq >= NR_IRQS || irq_timer_state[irq])
+       if (irq >= nr_irqs)
+               return;
+       state = get_timer_rand_state(irq);
+       if (state)
                return;
  
        /*
         */
        state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
        if (state)
-               irq_timer_state[irq] = state;
+               set_timer_rand_state(irq, state);
  }
  
  #ifdef CONFIG_BLOCK
@@@ -1205,7 -1231,7 +1231,7 @@@ static int proc_do_uuid(ctl_table *tabl
        return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
  }
  
 -static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
 +static int uuid_strategy(ctl_table *table,
                         void __user *oldval, size_t __user *oldlenp,
                         void __user *newval, size_t newlen)
  {
diff --combined drivers/gpio/gpiolib.c
index 22edc4273ef68cd46eceabe2ec249cca93faf0a5,572d372899d3ba79002e8a3aaeaf395633468d16..faa1cc66e9cf43a527beb4ce824d966dc407b494
@@@ -67,28 -67,17 +67,28 @@@ static inline void desc_set_label(struc
   * when setting direction, and otherwise illegal.  Until board setup code
   * and drivers use explicit requests everywhere (which won't happen when
   * those calls have no teeth) we can't avoid autorequesting.  This nag
 - * message should motivate switching to explicit requests...
 + * message should motivate switching to explicit requests... so should
 + * the weaker cleanup after faults, compared to gpio_request().
   */
 -static void gpio_ensure_requested(struct gpio_desc *desc)
 +static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset)
  {
        if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) {
 -              pr_warning("GPIO-%d autorequested\n", (int)(desc - gpio_desc));
 +              struct gpio_chip *chip = desc->chip;
 +              int gpio = chip->base + offset;
 +
 +              if (!try_module_get(chip->owner)) {
 +                      pr_err("GPIO-%d: module can't be gotten \n", gpio);
 +                      clear_bit(FLAG_REQUESTED, &desc->flags);
 +                      /* lose */
 +                      return -EIO;
 +              }
 +              pr_warning("GPIO-%d autorequested\n", gpio);
                desc_set_label(desc, "[auto]");
 -              if (!try_module_get(desc->chip->owner))
 -                      pr_err("GPIO-%d: module can't be gotten \n",
 -                                      (int)(desc - gpio_desc));
 +              /* caller must chip->request() w/o spinlock */
 +              if (chip->request)
 +                      return 1;
        }
 +      return 0;
  }
  
  /* caller holds gpio_lock *OR* gpio is marked as requested */
@@@ -248,7 -237,7 +248,7 @@@ static ssize_t gpio_value_show(struct d
        if (!test_bit(FLAG_EXPORT, &desc->flags))
                status = -EIO;
        else
 -              status = sprintf(buf, "%d\n", gpio_get_value_cansleep(gpio));
 +              status = sprintf(buf, "%d\n", !!gpio_get_value_cansleep(gpio));
  
        mutex_unlock(&sysfs_lock);
        return status;
@@@ -763,7 -752,6 +763,7 @@@ EXPORT_SYMBOL_GPL(gpiochip_remove)
  int gpio_request(unsigned gpio, const char *label)
  {
        struct gpio_desc        *desc;
 +      struct gpio_chip        *chip;
        int                     status = -EINVAL;
        unsigned long           flags;
  
        if (!gpio_is_valid(gpio))
                goto done;
        desc = &gpio_desc[gpio];
 -      if (desc->chip == NULL)
 +      chip = desc->chip;
 +      if (chip == NULL)
                goto done;
  
 -      if (!try_module_get(desc->chip->owner))
 +      if (!try_module_get(chip->owner))
                goto done;
  
        /* NOTE:  gpio_request() can be called in early boot,
 -       * before IRQs are enabled.
 +       * before IRQs are enabled, for non-sleeping (SOC) GPIOs.
         */
  
        if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) {
                status = 0;
        } else {
                status = -EBUSY;
 -              module_put(desc->chip->owner);
 +              module_put(chip->owner);
 +      }
 +
 +      if (chip->request) {
 +              /* chip->request may sleep */
 +              spin_unlock_irqrestore(&gpio_lock, flags);
 +              status = chip->request(chip, gpio - chip->base);
 +              spin_lock_irqsave(&gpio_lock, flags);
 +
 +              if (status < 0) {
 +                      desc_set_label(desc, NULL);
 +                      module_put(chip->owner);
 +                      clear_bit(FLAG_REQUESTED, &desc->flags);
 +              }
        }
  
  done:
@@@ -817,9 -791,6 +817,9 @@@ void gpio_free(unsigned gpio
  {
        unsigned long           flags;
        struct gpio_desc        *desc;
 +      struct gpio_chip        *chip;
 +
 +      might_sleep();
  
        if (!gpio_is_valid(gpio)) {
                WARN_ON(extra_checks);
        spin_lock_irqsave(&gpio_lock, flags);
  
        desc = &gpio_desc[gpio];
 -      if (desc->chip && test_and_clear_bit(FLAG_REQUESTED, &desc->flags)) {
 +      chip = desc->chip;
 +      if (chip && test_bit(FLAG_REQUESTED, &desc->flags)) {
 +              if (chip->free) {
 +                      spin_unlock_irqrestore(&gpio_lock, flags);
 +                      might_sleep_if(extra_checks && chip->can_sleep);
 +                      chip->free(chip, gpio - chip->base);
 +                      spin_lock_irqsave(&gpio_lock, flags);
 +              }
                desc_set_label(desc, NULL);
                module_put(desc->chip->owner);
 +              clear_bit(FLAG_REQUESTED, &desc->flags);
        } else
                WARN_ON(extra_checks);
  
@@@ -906,9 -869,7 +906,9 @@@ int gpio_direction_input(unsigned gpio
        gpio -= chip->base;
        if (gpio >= chip->ngpio)
                goto fail;
 -      gpio_ensure_requested(desc);
 +      status = gpio_ensure_requested(desc, gpio);
 +      if (status < 0)
 +              goto fail;
  
        /* now we know the gpio is valid and chip won't vanish */
  
  
        might_sleep_if(extra_checks && chip->can_sleep);
  
 +      if (status) {
 +              status = chip->request(chip, gpio);
 +              if (status < 0) {
 +                      pr_debug("GPIO-%d: chip request fail, %d\n",
 +                              chip->base + gpio, status);
 +                      /* and it's not available to anyone else ...
 +                       * gpio_request() is the fully clean solution.
 +                       */
 +                      goto lose;
 +              }
 +      }
 +
        status = chip->direction_input(chip, gpio);
        if (status == 0)
                clear_bit(FLAG_IS_OUT, &desc->flags);
 +lose:
        return status;
  fail:
        spin_unlock_irqrestore(&gpio_lock, flags);
@@@ -959,9 -907,7 +959,9 @@@ int gpio_direction_output(unsigned gpio
        gpio -= chip->base;
        if (gpio >= chip->ngpio)
                goto fail;
 -      gpio_ensure_requested(desc);
 +      status = gpio_ensure_requested(desc, gpio);
 +      if (status < 0)
 +              goto fail;
  
        /* now we know the gpio is valid and chip won't vanish */
  
  
        might_sleep_if(extra_checks && chip->can_sleep);
  
 +      if (status) {
 +              status = chip->request(chip, gpio);
 +              if (status < 0) {
 +                      pr_debug("GPIO-%d: chip request fail, %d\n",
 +                              chip->base + gpio, status);
 +                      /* and it's not available to anyone else ...
 +                       * gpio_request() is the fully clean solution.
 +                       */
 +                      goto lose;
 +              }
 +      }
 +
        status = chip->direction_output(chip, gpio, value);
        if (status == 0)
                set_bit(FLAG_IS_OUT, &desc->flags);
 +lose:
        return status;
  fail:
        spin_unlock_irqrestore(&gpio_lock, flags);
@@@ -1075,24 -1008,6 +1075,24 @@@ int __gpio_cansleep(unsigned gpio
  }
  EXPORT_SYMBOL_GPL(__gpio_cansleep);
  
 +/**
 + * __gpio_to_irq() - return the IRQ corresponding to a GPIO
 + * @gpio: gpio whose IRQ will be returned (already requested)
 + * Context: any
 + *
 + * This is used directly or indirectly to implement gpio_to_irq().
 + * It returns the number of the IRQ signaled by this (input) GPIO,
 + * or a negative errno.
 + */
 +int __gpio_to_irq(unsigned gpio)
 +{
 +      struct gpio_chip        *chip;
 +
 +      chip = gpio_to_chip(gpio);
 +      return chip->to_irq ? chip->to_irq(chip, gpio - chip->base) : -ENXIO;
 +}
 +EXPORT_SYMBOL_GPL(__gpio_to_irq);
 +
  
  
  /* There's no value in making it easy to inline GPIO calls that may sleep.
@@@ -1105,7 -1020,7 +1105,7 @@@ int gpio_get_value_cansleep(unsigned gp
  
        might_sleep_if(extra_checks);
        chip = gpio_to_chip(gpio);
 -      return chip->get(chip, gpio - chip->base);
 +      return chip->get ? chip->get(chip, gpio - chip->base) : 0;
  }
  EXPORT_SYMBOL_GPL(gpio_get_value_cansleep);
  
@@@ -1143,7 -1058,7 +1143,7 @@@ static void gpiolib_dbg_show(struct seq
  
                if (!is_out) {
                        int             irq = gpio_to_irq(gpio);
-                       struct irq_desc *desc = irq_desc + irq;
+                       struct irq_desc *desc = irq_to_desc(irq);
  
                        /* This races with request_irq(), set_irq_type(),
                         * and set_irq_wake() ... but those are "rare".
diff --combined drivers/mfd/htc-egpio.c
index 50dff6e0088d919fae79f7769f412dbf5cc297ed,ad3379fcd1946fbbea3fe4fb1580a5942389a4d9..1a4d04664d6dca96426c965b0ad80062f3042a95
@@@ -112,7 -112,7 +112,7 @@@ static void egpio_handler(unsigned int 
                /* Run irq handler */
                pr_debug("got IRQ %d\n", irqpin);
                irq = ei->irq_start + irqpin;
-               desc = &irq_desc[irq];
+               desc = irq_to_desc(irq);
                desc->handle_irq(irq, desc);
        }
  }
@@@ -289,7 -289,7 +289,7 @@@ static int __init egpio_probe(struct pl
        ei->base_addr = ioremap_nocache(res->start, res->end - res->start);
        if (!ei->base_addr)
                goto fail;
 -      pr_debug("EGPIO phys=%08x virt=%p\n", res->start, ei->base_addr);
 +      pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
  
        if ((pdata->bus_width != 16) && (pdata->bus_width != 32))
                goto fail;
diff --combined drivers/pci/dmar.c
index e842e756308a71c470e658164ec6c2163d5e8955,9527405ae19842eb5611dff2eff67d26a9c23675..8b29c307f1a11c0b94fe4e3214f6b62faf9c5063
@@@ -28,9 -28,9 +28,9 @@@
  
  #include <linux/pci.h>
  #include <linux/dmar.h>
 +#include <linux/iova.h>
 +#include <linux/intel-iommu.h>
  #include <linux/timer.h>
 -#include "iova.h"
 -#include "intel-iommu.h"
  
  #undef PREFIX
  #define PREFIX "DMAR:"
@@@ -193,7 -193,7 +193,7 @@@ dmar_parse_dev(struct dmar_drhd_unit *d
  {
        struct acpi_dmar_hardware_unit *drhd;
        static int include_all;
-       int ret;
+       int ret = 0;
  
        drhd = (struct acpi_dmar_hardware_unit *) dmaru->hdr;
  
                include_all = 1;
        }
  
-       if (ret || (dmaru->devices_cnt == 0 && !dmaru->include_all)) {
+       if (ret) {
                list_del(&dmaru->list);
                kfree(dmaru);
        }
@@@ -289,6 -289,24 +289,24 @@@ dmar_table_print_dmar_entry(struct acpi
        }
  }
  
+ /**
+  * dmar_table_detect - checks to see if the platform supports DMAR devices
+  */
+ static int __init dmar_table_detect(void)
+ {
+       acpi_status status = AE_OK;
+       /* if we could find DMAR table, then there are DMAR devices */
+       status = acpi_get_table(ACPI_SIG_DMAR, 0,
+                               (struct acpi_table_header **)&dmar_tbl);
+       if (ACPI_SUCCESS(status) && !dmar_tbl) {
+               printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
+               status = AE_NOT_FOUND;
+       }
+       return (ACPI_SUCCESS(status) ? 1 : 0);
+ }
  
  /**
   * parse_dmar_table - parses the DMA reporting table
@@@ -300,6 -318,12 +318,12 @@@ parse_dmar_table(void
        struct acpi_dmar_header *entry_header;
        int ret = 0;
  
+       /*
+        * Do it again, earlier dmar_tbl mapping could be mapped with
+        * fixed map.
+        */
+       dmar_table_detect();
        dmar = (struct acpi_table_dmar *)dmar_tbl;
        if (!dmar)
                return -ENODEV;
@@@ -373,10 -397,10 +397,10 @@@ dmar_find_matched_drhd_unit(struct pci_
  
  int __init dmar_dev_scope_init(void)
  {
-       struct dmar_drhd_unit *drhd;
+       struct dmar_drhd_unit *drhd, *drhd_n;
        int ret = -ENODEV;
  
-       for_each_drhd_unit(drhd) {
+       list_for_each_entry_safe(drhd, drhd_n, &dmar_drhd_units, list) {
                ret = dmar_parse_dev(drhd);
                if (ret)
                        return ret;
  
  #ifdef CONFIG_DMAR
        {
-               struct dmar_rmrr_unit *rmrr;
-               for_each_rmrr_units(rmrr) {
+               struct dmar_rmrr_unit *rmrr, *rmrr_n;
+               list_for_each_entry_safe(rmrr, rmrr_n, &dmar_rmrr_units, list) {
                        ret = rmrr_parse_dev(rmrr);
                        if (ret)
                                return ret;
@@@ -430,30 -454,11 +454,11 @@@ int __init dmar_table_init(void
        return 0;
  }
  
- /**
-  * early_dmar_detect - checks to see if the platform supports DMAR devices
-  */
- int __init early_dmar_detect(void)
- {
-       acpi_status status = AE_OK;
-       /* if we could find DMAR table, then there are DMAR devices */
-       status = acpi_get_table(ACPI_SIG_DMAR, 0,
-                               (struct acpi_table_header **)&dmar_tbl);
-       if (ACPI_SUCCESS(status) && !dmar_tbl) {
-               printk (KERN_WARNING PREFIX "Unable to map DMAR\n");
-               status = AE_NOT_FOUND;
-       }
-       return (ACPI_SUCCESS(status) ? 1 : 0);
- }
  void __init detect_intel_iommu(void)
  {
        int ret;
  
-       ret = early_dmar_detect();
+       ret = dmar_table_detect();
  
  #ifdef CONFIG_DMAR
        {
                               " x2apic support\n");
  
                        dmar_disabled = 1;
-                       return;
+                       goto end;
                }
  
                if (ret && !no_iommu && !iommu_detected && !swiotlb &&
                    !dmar_disabled)
                        iommu_detected = 1;
        }
+ end:
  #endif
+       dmar_tbl = NULL;
  }
  
  
index 738d4c89581cc7a41f5c2746add5dca767ad81be,d6040dd3ff5b65517e92ec3519aa1344175f217b..2de5a3238c947be89213119d9cf468d2fa59e11d
@@@ -1,51 -1,75 +1,75 @@@
+ #include <linux/interrupt.h>
  #include <linux/dmar.h>
  #include <linux/spinlock.h>
  #include <linux/jiffies.h>
  #include <linux/pci.h>
  #include <linux/irq.h>
  #include <asm/io_apic.h>
 -#include "intel-iommu.h"
 +#include <linux/intel-iommu.h>
  #include "intr_remapping.h"
  
  static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
  static int ir_ioapic_num;
  int intr_remapping_enabled;
  
- static struct {
+ struct irq_2_iommu {
        struct intel_iommu *iommu;
        u16 irte_index;
        u16 sub_handle;
        u8  irte_mask;
- } irq_2_iommu[NR_IRQS];
+ };
+ static struct irq_2_iommu irq_2_iommuX[NR_IRQS];
+ static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
+ {
+       return (irq < nr_irqs) ? irq_2_iommuX + irq : NULL;
+ }
+ static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
+ {
+       return irq_2_iommu(irq);
+ }
  
  static DEFINE_SPINLOCK(irq_2_ir_lock);
  
int irq_remapped(int irq)
static struct irq_2_iommu *valid_irq_2_iommu(unsigned int irq)
  {
-       if (irq > NR_IRQS)
-               return 0;
+       struct irq_2_iommu *irq_iommu;
+       irq_iommu = irq_2_iommu(irq);
+       if (!irq_iommu)
+               return NULL;
+       if (!irq_iommu->iommu)
+               return NULL;
  
-       if (!irq_2_iommu[irq].iommu)
-               return 0;
+       return irq_iommu;
+ }
  
-       return 1;
+ int irq_remapped(int irq)
+ {
+       return valid_irq_2_iommu(irq) != NULL;
  }
  
  int get_irte(int irq, struct irte *entry)
  {
        int index;
+       struct irq_2_iommu *irq_iommu;
  
-       if (!entry || irq > NR_IRQS)
+       if (!entry)
                return -1;
  
        spin_lock(&irq_2_ir_lock);
-       if (!irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle;
-       *entry = *(irq_2_iommu[irq].iommu->ir_table->base + index);
+       index = irq_iommu->irte_index + irq_iommu->sub_handle;
+       *entry = *(irq_iommu->iommu->ir_table->base + index);
  
        spin_unlock(&irq_2_ir_lock);
        return 0;
@@@ -54,6 -78,7 +78,7 @@@
  int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
  {
        struct ir_table *table = iommu->ir_table;
+       struct irq_2_iommu *irq_iommu;
        u16 index, start_index;
        unsigned int mask = 0;
        int i;
        if (!count)
                return -1;
  
+       /* protect irq_2_iommu_alloc later */
+       if (irq >= nr_irqs)
+               return -1;
        /*
         * start the IRTE search from index 0.
         */
        for (i = index; i < index + count; i++)
                table->base[i].present = 1;
  
-       irq_2_iommu[irq].iommu = iommu;
-       irq_2_iommu[irq].irte_index =  index;
-       irq_2_iommu[irq].sub_handle = 0;
-       irq_2_iommu[irq].irte_mask = mask;
+       irq_iommu = irq_2_iommu_alloc(irq);
+       irq_iommu->iommu = iommu;
+       irq_iommu->irte_index =  index;
+       irq_iommu->sub_handle = 0;
+       irq_iommu->irte_mask = mask;
  
        spin_unlock(&irq_2_ir_lock);
  
@@@ -124,31 -154,33 +154,33 @@@ static void qi_flush_iec(struct intel_i
  int map_irq_to_irte_handle(int irq, u16 *sub_handle)
  {
        int index;
+       struct irq_2_iommu *irq_iommu;
  
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       *sub_handle = irq_2_iommu[irq].sub_handle;
-       index = irq_2_iommu[irq].irte_index;
+       *sub_handle = irq_iommu->sub_handle;
+       index = irq_iommu->irte_index;
        spin_unlock(&irq_2_ir_lock);
        return index;
  }
  
  int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, u16 subhandle)
  {
+       struct irq_2_iommu *irq_iommu;
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || irq_2_iommu[irq].iommu) {
-               spin_unlock(&irq_2_ir_lock);
-               return -1;
-       }
  
-       irq_2_iommu[irq].iommu = iommu;
-       irq_2_iommu[irq].irte_index = index;
-       irq_2_iommu[irq].sub_handle = subhandle;
-       irq_2_iommu[irq].irte_mask = 0;
+       irq_iommu = irq_2_iommu_alloc(irq);
+       irq_iommu->iommu = iommu;
+       irq_iommu->irte_index = index;
+       irq_iommu->sub_handle = subhandle;
+       irq_iommu->irte_mask = 0;
  
        spin_unlock(&irq_2_ir_lock);
  
  
  int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index)
  {
+       struct irq_2_iommu *irq_iommu;
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       irq_2_iommu[irq].iommu = NULL;
-       irq_2_iommu[irq].irte_index = 0;
-       irq_2_iommu[irq].sub_handle = 0;
-       irq_2_iommu[irq].irte_mask = 0;
+       irq_iommu->iommu = NULL;
+       irq_iommu->irte_index = 0;
+       irq_iommu->sub_handle = 0;
+       irq_2_iommu(irq)->irte_mask = 0;
  
        spin_unlock(&irq_2_ir_lock);
  
@@@ -178,16 -213,18 +213,18 @@@ int modify_irte(int irq, struct irte *i
        int index;
        struct irte *irte;
        struct intel_iommu *iommu;
+       struct irq_2_iommu *irq_iommu;
  
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       iommu = irq_2_iommu[irq].iommu;
+       iommu = irq_iommu->iommu;
  
-       index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle;
+       index = irq_iommu->irte_index + irq_iommu->sub_handle;
        irte = &iommu->ir_table->base[index];
  
        set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1));
@@@ -203,18 -240,20 +240,20 @@@ int flush_irte(int irq
  {
        int index;
        struct intel_iommu *iommu;
+       struct irq_2_iommu *irq_iommu;
  
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       iommu = irq_2_iommu[irq].iommu;
+       iommu = irq_iommu->iommu;
  
-       index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle;
+       index = irq_iommu->irte_index + irq_iommu->sub_handle;
  
-       qi_flush_iec(iommu, index, irq_2_iommu[irq].irte_mask);
+       qi_flush_iec(iommu, index, irq_iommu->irte_mask);
        spin_unlock(&irq_2_ir_lock);
  
        return 0;
@@@ -246,28 -285,30 +285,30 @@@ int free_irte(int irq
        int index, i;
        struct irte *irte;
        struct intel_iommu *iommu;
+       struct irq_2_iommu *irq_iommu;
  
        spin_lock(&irq_2_ir_lock);
-       if (irq >= NR_IRQS || !irq_2_iommu[irq].iommu) {
+       irq_iommu = valid_irq_2_iommu(irq);
+       if (!irq_iommu) {
                spin_unlock(&irq_2_ir_lock);
                return -1;
        }
  
-       iommu = irq_2_iommu[irq].iommu;
+       iommu = irq_iommu->iommu;
  
-       index = irq_2_iommu[irq].irte_index + irq_2_iommu[irq].sub_handle;
+       index = irq_iommu->irte_index + irq_iommu->sub_handle;
        irte = &iommu->ir_table->base[index];
  
-       if (!irq_2_iommu[irq].sub_handle) {
-               for (i = 0; i < (1 << irq_2_iommu[irq].irte_mask); i++)
+       if (!irq_iommu->sub_handle) {
+               for (i = 0; i < (1 << irq_iommu->irte_mask); i++)
                        set_64bit((unsigned long *)irte, 0);
-               qi_flush_iec(iommu, index, irq_2_iommu[irq].irte_mask);
+               qi_flush_iec(iommu, index, irq_iommu->irte_mask);
        }
  
-       irq_2_iommu[irq].iommu = NULL;
-       irq_2_iommu[irq].irte_index = 0;
-       irq_2_iommu[irq].sub_handle = 0;
-       irq_2_iommu[irq].irte_mask = 0;
+       irq_iommu->iommu = NULL;
+       irq_iommu->irte_index = 0;
+       irq_iommu->sub_handle = 0;
+       irq_iommu->irte_mask = 0;
  
        spin_unlock(&irq_2_ir_lock);
  
diff --combined drivers/serial/8250.c
index 1528de23a6504987f78038db7be1e933e4762364,006617e2211d91635219acdfd0cdf9f0e8e7cf94..303272af386ef4ac307517d6df654759cbc23d43
@@@ -156,11 -156,15 +156,15 @@@ struct uart_8250_port 
  };
  
  struct irq_info {
-       spinlock_t              lock;
+       struct                  hlist_node node;
+       int                     irq;
+       spinlock_t              lock;   /* Protects list not the hash */
        struct list_head        *head;
  };
  
- static struct irq_info irq_lists[NR_IRQS];
+ #define NR_IRQ_HASH           32      /* Can be adjusted later */
+ static struct hlist_head irq_lists[NR_IRQ_HASH];
+ static DEFINE_MUTEX(hash_mutex);      /* Used to walk the hash */
  
  /*
   * Here we define the default xmit fifo size used for each type of UART.
@@@ -1545,15 -1549,43 +1549,43 @@@ static void serial_do_unlink(struct irq
                BUG_ON(i->head != &up->list);
                i->head = NULL;
        }
        spin_unlock_irq(&i->lock);
+       /* List empty so throw away the hash node */
+       if (i->head == NULL) {
+               hlist_del(&i->node);
+               kfree(i);
+       }
  }
  
  static int serial_link_irq_chain(struct uart_8250_port *up)
  {
-       struct irq_info *i = irq_lists + up->port.irq;
+       struct hlist_head *h;
+       struct hlist_node *n;
+       struct irq_info *i;
        int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
  
+       mutex_lock(&hash_mutex);
+       h = &irq_lists[up->port.irq % NR_IRQ_HASH];
+       hlist_for_each(n, h) {
+               i = hlist_entry(n, struct irq_info, node);
+               if (i->irq == up->port.irq)
+                       break;
+       }
+       if (n == NULL) {
+               i = kzalloc(sizeof(struct irq_info), GFP_KERNEL);
+               if (i == NULL) {
+                       mutex_unlock(&hash_mutex);
+                       return -ENOMEM;
+               }
+               spin_lock_init(&i->lock);
+               i->irq = up->port.irq;
+               hlist_add_head(&i->node, h);
+       }
+       mutex_unlock(&hash_mutex);
        spin_lock_irq(&i->lock);
  
        if (i->head) {
  
  static void serial_unlink_irq_chain(struct uart_8250_port *up)
  {
-       struct irq_info *i = irq_lists + up->port.irq;
+       struct irq_info *i;
+       struct hlist_node *n;
+       struct hlist_head *h;
  
+       mutex_lock(&hash_mutex);
+       h = &irq_lists[up->port.irq % NR_IRQ_HASH];
+       hlist_for_each(n, h) {
+               i = hlist_entry(n, struct irq_info, node);
+               if (i->irq == up->port.irq)
+                       break;
+       }
+       BUG_ON(n == NULL);
        BUG_ON(i->head == NULL);
  
        if (list_empty(i->head))
                free_irq(up->port.irq, i);
  
        serial_do_unlink(i, up);
+       mutex_unlock(&hash_mutex);
  }
  
  /* Base timer interval for polling */
@@@ -2223,9 -2269,9 +2269,9 @@@ serial8250_set_termios(struct uart_por
                serial_outp(up, UART_EFR, efr);
        }
  
 -#ifdef CONFIG_ARCH_OMAP15XX
 +#ifdef CONFIG_ARCH_OMAP
        /* Workaround to enable 115200 baud on OMAP1510 internal ports */
 -      if (cpu_is_omap1510() && is_omap_port((unsigned int)up->port.membase)) {
 +      if (cpu_is_omap1510() && is_omap_port(up)) {
                if (baud == 115200) {
                        quot = 1;
                        serial_out(up, UART_OMAP_OSC_12M_SEL, 1);
@@@ -2278,27 -2324,18 +2324,27 @@@ serial8250_pm(struct uart_port *port, u
                p->pm(port, state, oldstate);
  }
  
 +static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 +{
 +      if (pt->port.iotype == UPIO_AU)
 +              return 0x100000;
 +#ifdef CONFIG_ARCH_OMAP
 +      if (is_omap_port(pt))
 +              return 0x16 << pt->port.regshift;
 +#endif
 +      return 8 << pt->port.regshift;
 +}
 +
  /*
   * Resource handling.
   */
  static int serial8250_request_std_resource(struct uart_8250_port *up)
  {
 -      unsigned int size = 8 << up->port.regshift;
 +      unsigned int size = serial8250_port_size(up);
        int ret = 0;
  
        switch (up->port.iotype) {
        case UPIO_AU:
 -              size = 0x100000;
 -              /* fall thru */
        case UPIO_TSI:
        case UPIO_MEM32:
        case UPIO_MEM:
  
  static void serial8250_release_std_resource(struct uart_8250_port *up)
  {
 -      unsigned int size = 8 << up->port.regshift;
 +      unsigned int size = serial8250_port_size(up);
  
        switch (up->port.iotype) {
        case UPIO_AU:
 -              size = 0x100000;
 -              /* fall thru */
        case UPIO_TSI:
        case UPIO_MEM32:
        case UPIO_MEM:
@@@ -2447,7 -2486,7 +2493,7 @@@ static void serial8250_config_port(stru
  static int
  serial8250_verify_port(struct uart_port *port, struct serial_struct *ser)
  {
-       if (ser->irq >= NR_IRQS || ser->irq < 0 ||
+       if (ser->irq >= nr_irqs || ser->irq < 0 ||
            ser->baud_base < 9600 || ser->type < PORT_UNKNOWN ||
            ser->type >= ARRAY_SIZE(uart_config) || ser->type == PORT_CIRRUS ||
            ser->type == PORT_STARTECH)
@@@ -2967,7 -3006,7 +3013,7 @@@ EXPORT_SYMBOL(serial8250_unregister_por
  
  static int __init serial8250_init(void)
  {
-       int ret, i;
+       int ret;
  
        if (nr_uarts > UART_NR)
                nr_uarts = UART_NR;
                "%d ports, IRQ sharing %sabled\n", nr_uarts,
                share_irqs ? "en" : "dis");
  
-       for (i = 0; i < NR_IRQS; i++)
-               spin_lock_init(&irq_lists[i].lock);
  #ifdef CONFIG_SPARC
        ret = sunserial_register_minors(&serial8250_reg, UART_NR);
  #else
                goto out;
  
        platform_device_del(serial8250_isa_devs);
 put_dev:
+ put_dev:
        platform_device_put(serial8250_isa_devs);
 unreg_uart_drv:
+ unreg_uart_drv:
  #ifdef CONFIG_SPARC
        sunserial_unregister_minors(&serial8250_reg, UART_NR);
  #else
        uart_unregister_driver(&serial8250_reg);
  #endif
 out:
+ out:
        return ret;
  }
  
index a6c4d744495e3b694894c35453bbac4a0baff512,e54574c49a380966add8feecbb3e025608518840..bde4b4b0b80f08efe1f2c5db4da2fb7e0e61b9b5
@@@ -623,7 -623,7 +623,7 @@@ static int cpm_uart_verify_port(struct 
  
        if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM)
                ret = -EINVAL;
-       if (ser->irq < 0 || ser->irq >= NR_IRQS)
+       if (ser->irq < 0 || ser->irq >= nr_irqs)
                ret = -EINVAL;
        if (ser->baud_base < 9600)
                ret = -EINVAL;
@@@ -1333,9 -1333,6 +1333,9 @@@ static int __devinit cpm_uart_probe(str
        if (ret)
                return ret;
  
 +      /* initialize the device pointer for the port */
 +      pinfo->port.dev = &ofdev->dev;
 +
        return uart_add_one_port(&cpm_reg, &pinfo->port);
  }
  
diff --combined drivers/serial/sh-sci.c
index 3b9d2d83b59008df447dfcff84bb1fc33e5f4425,667b4b8fd07404f965e297d92b7a431af4378d62..f0658d2c45b20e2aa462f3d4b3db29e27fc0773f
@@@ -3,7 -3,7 +3,7 @@@
   *
   * SuperH on-chip serial module support.  (SCI with no FIFO / with FIFO)
   *
 - *  Copyright (C) 2002 - 2006  Paul Mundt
 + *  Copyright (C) 2002 - 2008  Paul Mundt
   *  Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007).
   *
   * based off of the old drivers/char/sh-sci.c by:
@@@ -46,7 -46,6 +46,7 @@@
  #include <linux/cpufreq.h>
  #include <linux/clk.h>
  #include <linux/ctype.h>
 +#include <linux/err.h>
  
  #ifdef CONFIG_SUPERH
  #include <asm/clock.h>
@@@ -79,7 -78,7 +79,7 @@@ struct sci_port 
        struct timer_list       break_timer;
        int                     break_flag;
  
 -#ifdef CONFIG_SUPERH
 +#ifdef CONFIG_HAVE_CLK
        /* Port clock */
        struct clk              *clk;
  #endif
@@@ -832,7 -831,7 +832,7 @@@ static irqreturn_t sci_mpxed_interrupt(
        return IRQ_HANDLED;
  }
  
 -#ifdef CONFIG_CPU_FREQ
 +#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK)
  /*
   * Here we define a transistion notifier so that we can update all of our
   * ports' baud rate when the peripheral clock changes.
@@@ -861,7 -860,7 +861,7 @@@ static int sci_notifier(struct notifier
                         * Clean this up later..
                         */
                        clk = clk_get(NULL, "module_clk");
 -                      port->uartclk = clk_get_rate(clk) * 16;
 +                      port->uartclk = clk_get_rate(clk);
                        clk_put(clk);
                }
  
  }
  
  static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 };
 -#endif /* CONFIG_CPU_FREQ */
 +#endif /* CONFIG_CPU_FREQ && CONFIG_HAVE_CLK */
  
  static int sci_request_irq(struct sci_port *port)
  {
@@@ -1009,7 -1008,7 +1009,7 @@@ static int sci_startup(struct uart_por
        if (s->enable)
                s->enable(port);
  
 -#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
 +#ifdef CONFIG_HAVE_CLK
        s->clk = clk_get(NULL, "module_clk");
  #endif
  
@@@ -1031,7 -1030,7 +1031,7 @@@ static void sci_shutdown(struct uart_po
        if (s->disable)
                s->disable(port);
  
 -#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
 +#ifdef CONFIG_HAVE_CLK
        clk_put(s->clk);
        s->clk = NULL;
  #endif
@@@ -1042,11 -1041,24 +1042,11 @@@ static void sci_set_termios(struct uart
  {
        struct sci_port *s = &sci_ports[port->line];
        unsigned int status, baud, smr_val;
 -      int t;
 +      int t = -1;
  
        baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
 -
 -      switch (baud) {
 -              case 0:
 -                      t = -1;
 -                      break;
 -              default:
 -              {
 -#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
 -                      t = SCBRR_VALUE(baud, clk_get_rate(s->clk));
 -#else
 -                      t = SCBRR_VALUE(baud);
 -#endif
 -                      break;
 -              }
 -      }
 +      if (likely(baud))
 +              t = SCBRR_VALUE(baud, port->uartclk);
  
        do {
                status = sci_in(port, SCxSR);
@@@ -1101,7 -1113,7 +1101,7 @@@ static const char *sci_type(struct uart
                case PORT_IRDA: return "irda";
        }
  
 -      return 0;
 +      return NULL;
  }
  
  static void sci_release_port(struct uart_port *port)
@@@ -1133,23 -1145,19 +1133,23 @@@ static void sci_config_port(struct uart
                break;
        }
  
 -#if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
 -      if (port->mapbase == 0)
 +      if (port->flags & UPF_IOREMAP && !port->membase) {
 +#if defined(CONFIG_SUPERH64)
                port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF");
 -
 -      port->membase = (void __iomem *)port->mapbase;
 +              port->membase = (void __iomem *)port->mapbase;
 +#else
 +              port->membase = ioremap_nocache(port->mapbase, 0x40);
  #endif
 +
 +              printk(KERN_ERR "sci: can't remap port#%d\n", port->line);
 +      }
  }
  
  static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
  {
        struct sci_port *s = &sci_ports[port->line];
  
-       if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > NR_IRQS)
+       if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs)
                return -EINVAL;
        if (ser->baud_base < 2400)
                /* No paper tape reader for Mitch.. */
@@@ -1199,17 -1207,17 +1199,17 @@@ static void __init sci_init_ports(void
                sci_ports[i].disable    = h8300_sci_disable;
  #endif
                sci_ports[i].port.uartclk = CONFIG_CPU_CLOCK;
 -#elif defined(CONFIG_SUPERH64)
 -              sci_ports[i].port.uartclk = current_cpu_data.module_clock * 16;
 -#else
 +#elif defined(CONFIG_HAVE_CLK)
                /*
                 * XXX: We should use a proper SCI/SCIF clock
                 */
                {
                        struct clk *clk = clk_get(NULL, "module_clk");
 -                      sci_ports[i].port.uartclk = clk_get_rate(clk) * 16;
 +                      sci_ports[i].port.uartclk = clk_get_rate(clk);
                        clk_put(clk);
                }
 +#else
 +#error "Need a valid uartclk"
  #endif
  
                sci_ports[i].break_timer.data = (unsigned long)&sci_ports[i];
@@@ -1277,7 -1285,7 +1277,7 @@@ static int __init serial_console_setup(
  
        port->type = serial_console_port->type;
  
 -#if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64)
 +#ifdef CONFIG_HAVE_CLK
        if (!serial_console_port->clk)
                serial_console_port->clk = clk_get(NULL, "module_clk");
  #endif
@@@ -1428,7 -1436,7 +1428,7 @@@ static struct uart_driver sci_uart_driv
  static int __devinit sci_probe(struct platform_device *dev)
  {
        struct plat_sci_port *p = dev->dev.platform_data;
 -      int i;
 +      int i, ret = -EINVAL;
  
        for (i = 0; p && p->flags != 0; p++, i++) {
                struct sci_port *sciport = &sci_ports[i];
  
                sciport->port.mapbase   = p->mapbase;
  
 -              /*
 -               * For the simple (and majority of) cases where we don't need
 -               * to do any remapping, just cast the cookie directly.
 -               */
 -              if (p->mapbase && !p->membase && !(p->flags & UPF_IOREMAP))
 -                      p->membase = (void __iomem *)p->mapbase;
 +              if (p->mapbase && !p->membase) {
 +                      if (p->flags & UPF_IOREMAP) {
 +                              p->membase = ioremap_nocache(p->mapbase, 0x40);
 +                              if (IS_ERR(p->membase)) {
 +                                      ret = PTR_ERR(p->membase);
 +                                      goto err_unreg;
 +                              }
 +                      } else {
 +                              /*
 +                               * For the simple (and majority of) cases
 +                               * where we don't need to do any remapping,
 +                               * just cast the cookie directly.
 +                               */
 +                              p->membase = (void __iomem *)p->mapbase;
 +                      }
 +              }
  
                sciport->port.membase   = p->membase;
  
        kgdb_putchar    = kgdb_sci_putchar;
  #endif
  
 -#ifdef CONFIG_CPU_FREQ
 +#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK)
        cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER);
        dev_info(&dev->dev, "CPU frequency notifier registered\n");
  #endif
  #endif
  
        return 0;
 +
 +err_unreg:
 +      for (i = i - 1; i >= 0; i--)
 +              uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port);
 +
 +      return ret;
  }
  
  static int __devexit sci_remove(struct platform_device *dev)
index 539c933b335f306b2dc92182785ab09cf271cec6,503f0b99a3b89c93f1404285fdff0ebd78a8748f..315a9333ca3cd1b7723197c74d0ebec1fe6fcdf3
@@@ -1009,7 -1009,7 +1009,7 @@@ static int qe_uart_request_port(struct 
        rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize);
        tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize);
  
 -      bd_virt = dma_alloc_coherent(NULL, rx_size + tx_size, &bd_dma_addr,
 +      bd_virt = dma_alloc_coherent(port->dev, rx_size + tx_size, &bd_dma_addr,
                GFP_KERNEL);
        if (!bd_virt) {
                dev_err(port->dev, "could not allocate buffer descriptors\n");
@@@ -1051,7 -1051,7 +1051,7 @@@ static void qe_uart_release_port(struc
                container_of(port, struct uart_qe_port, port);
        struct ucc_slow_private *uccs = qe_port->us_private;
  
 -      dma_free_coherent(NULL, qe_port->bd_size, qe_port->bd_virt,
 +      dma_free_coherent(port->dev, qe_port->bd_size, qe_port->bd_virt,
                          qe_port->bd_dma_addr);
  
        ucc_slow_free(uccs);
@@@ -1066,7 -1066,7 +1066,7 @@@ static int qe_uart_verify_port(struct u
        if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM)
                return -EINVAL;
  
-       if (ser->irq < 0 || ser->irq >= NR_IRQS)
+       if (ser->irq < 0 || ser->irq >= nr_irqs)
                return -EINVAL;
  
        if (ser->baud_base < 9600)
diff --combined fs/proc/proc_misc.c
index 61b25f4eabe6635bdf013e4879dd8e725f10f01d,97b4579134d5a214b72df51bd6530b1f40caba65..7ea52c79b2da6bf713d2da2598b647dbbb450c9e
@@@ -30,6 -30,7 +30,7 @@@
  #include <linux/mm.h>
  #include <linux/mmzone.h>
  #include <linux/pagemap.h>
+ #include <linux/irq.h>
  #include <linux/interrupt.h>
  #include <linux/swap.h>
  #include <linux/slab.h>
@@@ -45,6 -46,7 +46,6 @@@
  #include <linux/blkdev.h>
  #include <linux/hugetlb.h>
  #include <linux/jiffies.h>
 -#include <linux/sysrq.h>
  #include <linux/vmalloc.h>
  #include <linux/crash_dump.h>
  #include <linux/pid_namespace.h>
@@@ -136,8 -138,6 +137,8 @@@ static int meminfo_read_proc(char *page
        unsigned long allowed;
        struct vmalloc_info vmi;
        long cached;
 +      unsigned long pages[NR_LRU_LISTS];
 +      int lru;
  
  /*
   * display in kilobytes.
  
        get_vmalloc_info(&vmi);
  
 +      for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++)
 +              pages[lru] = global_page_state(NR_LRU_BASE + lru);
 +
        /*
         * Tagged format, for easy grepping and expansion.
         */
        len = sprintf(page,
 -              "MemTotal:     %8lu kB\n"
 -              "MemFree:      %8lu kB\n"
 -              "Buffers:      %8lu kB\n"
 -              "Cached:       %8lu kB\n"
 -              "SwapCached:   %8lu kB\n"
 -              "Active:       %8lu kB\n"
 -              "Inactive:     %8lu kB\n"
 +              "MemTotal:       %8lu kB\n"
 +              "MemFree:        %8lu kB\n"
 +              "Buffers:        %8lu kB\n"
 +              "Cached:         %8lu kB\n"
 +              "SwapCached:     %8lu kB\n"
 +              "Active:         %8lu kB\n"
 +              "Inactive:       %8lu kB\n"
 +              "Active(anon):   %8lu kB\n"
 +              "Inactive(anon): %8lu kB\n"
 +              "Active(file):   %8lu kB\n"
 +              "Inactive(file): %8lu kB\n"
 +#ifdef CONFIG_UNEVICTABLE_LRU
 +              "Unevictable:    %8lu kB\n"
 +              "Mlocked:        %8lu kB\n"
 +#endif
  #ifdef CONFIG_HIGHMEM
 -              "HighTotal:    %8lu kB\n"
 -              "HighFree:     %8lu kB\n"
 -              "LowTotal:     %8lu kB\n"
 -              "LowFree:      %8lu kB\n"
 +              "HighTotal:      %8lu kB\n"
 +              "HighFree:       %8lu kB\n"
 +              "LowTotal:       %8lu kB\n"
 +              "LowFree:        %8lu kB\n"
  #endif
 -              "SwapTotal:    %8lu kB\n"
 -              "SwapFree:     %8lu kB\n"
 -              "Dirty:        %8lu kB\n"
 -              "Writeback:    %8lu kB\n"
 -              "AnonPages:    %8lu kB\n"
 -              "Mapped:       %8lu kB\n"
 -              "Slab:         %8lu kB\n"
 -              "SReclaimable: %8lu kB\n"
 -              "SUnreclaim:   %8lu kB\n"
 -              "PageTables:   %8lu kB\n"
 +              "SwapTotal:      %8lu kB\n"
 +              "SwapFree:       %8lu kB\n"
 +              "Dirty:          %8lu kB\n"
 +              "Writeback:      %8lu kB\n"
 +              "AnonPages:      %8lu kB\n"
 +              "Mapped:         %8lu kB\n"
 +              "Slab:           %8lu kB\n"
 +              "SReclaimable:   %8lu kB\n"
 +              "SUnreclaim:     %8lu kB\n"
 +              "PageTables:     %8lu kB\n"
  #ifdef CONFIG_QUICKLIST
 -              "Quicklists:   %8lu kB\n"
 +              "Quicklists:     %8lu kB\n"
  #endif
 -              "NFS_Unstable: %8lu kB\n"
 -              "Bounce:       %8lu kB\n"
 -              "WritebackTmp: %8lu kB\n"
 -              "CommitLimit:  %8lu kB\n"
 -              "Committed_AS: %8lu kB\n"
 -              "VmallocTotal: %8lu kB\n"
 -              "VmallocUsed:  %8lu kB\n"
 -              "VmallocChunk: %8lu kB\n",
 +              "NFS_Unstable:   %8lu kB\n"
 +              "Bounce:         %8lu kB\n"
 +              "WritebackTmp:   %8lu kB\n"
 +              "CommitLimit:    %8lu kB\n"
 +              "Committed_AS:   %8lu kB\n"
 +              "VmallocTotal:   %8lu kB\n"
 +              "VmallocUsed:    %8lu kB\n"
 +              "VmallocChunk:   %8lu kB\n",
                K(i.totalram),
                K(i.freeram),
                K(i.bufferram),
                K(cached),
                K(total_swapcache_pages),
 -              K(global_page_state(NR_ACTIVE)),
 -              K(global_page_state(NR_INACTIVE)),
 +              K(pages[LRU_ACTIVE_ANON]   + pages[LRU_ACTIVE_FILE]),
 +              K(pages[LRU_INACTIVE_ANON] + pages[LRU_INACTIVE_FILE]),
 +              K(pages[LRU_ACTIVE_ANON]),
 +              K(pages[LRU_INACTIVE_ANON]),
 +              K(pages[LRU_ACTIVE_FILE]),
 +              K(pages[LRU_INACTIVE_FILE]),
 +#ifdef CONFIG_UNEVICTABLE_LRU
 +              K(pages[LRU_UNEVICTABLE]),
 +              K(global_page_state(NR_MLOCK)),
 +#endif
  #ifdef CONFIG_HIGHMEM
                K(i.totalhigh),
                K(i.freehigh),
@@@ -521,17 -502,13 +522,13 @@@ static const struct file_operations pro
  
  static int show_stat(struct seq_file *p, void *v)
  {
-       int i;
+       int i, j;
        unsigned long jif;
        cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
        cputime64_t guest;
        u64 sum = 0;
        struct timespec boottime;
-       unsigned int *per_irq_sum;
-       per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL);
-       if (!per_irq_sum)
-               return -ENOMEM;
+       unsigned int per_irq_sum;
  
        user = nice = system = idle = iowait =
                irq = softirq = steal = cputime64_zero;
        jif = boottime.tv_sec;
  
        for_each_possible_cpu(i) {
-               int j;
                user = cputime64_add(user, kstat_cpu(i).cpustat.user);
                nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice);
                system = cputime64_add(system, kstat_cpu(i).cpustat.system);
                softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
                steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
                guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
-               for (j = 0; j < NR_IRQS; j++) {
-                       unsigned int temp = kstat_cpu(i).irqs[j];
-                       sum += temp;
-                       per_irq_sum[j] += temp;
-               }
+               for_each_irq_nr(j)
+                       sum += kstat_irqs_cpu(j, i);
                sum += arch_irq_stat_cpu(i);
        }
        sum += arch_irq_stat();
        }
        seq_printf(p, "intr %llu", (unsigned long long)sum);
  
-       for (i = 0; i < NR_IRQS; i++)
-               seq_printf(p, " %u", per_irq_sum[i]);
+       /* sum again ? it could be updated? */
+       for_each_irq_nr(j) {
+               per_irq_sum = 0;
+               for_each_possible_cpu(i)
+                       per_irq_sum += kstat_irqs_cpu(j, i);
+               seq_printf(p, " %u", per_irq_sum);
+       }
  
        seq_printf(p,
                "\nctxt %llu\n"
                nr_running(),
                nr_iowait());
  
-       kfree(per_irq_sum);
        return 0;
  }
  
@@@ -651,15 -631,14 +651,14 @@@ static const struct file_operations pro
   */
  static void *int_seq_start(struct seq_file *f, loff_t *pos)
  {
-       return (*pos <= NR_IRQS) ? pos : NULL;
+       return (*pos <= nr_irqs) ? pos : NULL;
  }
  
  static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
  {
        (*pos)++;
-       if (*pos > NR_IRQS)
-               return NULL;
-       return pos;
+       return (*pos <= nr_irqs) ? pos : NULL;
  }
  
  static void int_seq_stop(struct seq_file *f, void *v)
        /* Nothing to do */
  }
  
  static const struct seq_operations int_seq_ops = {
        .start = int_seq_start,
        .next  = int_seq_next,
@@@ -724,6 -702,28 +722,6 @@@ static int execdomains_read_proc(char *
        return proc_calc_metrics(page, start, off, count, eof, len);
  }
  
 -#ifdef CONFIG_MAGIC_SYSRQ
 -/*
 - * writing 'C' to /proc/sysrq-trigger is like sysrq-C
 - */
 -static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
 -                                 size_t count, loff_t *ppos)
 -{
 -      if (count) {
 -              char c;
 -
 -              if (get_user(c, buf))
 -                      return -EFAULT;
 -              __handle_sysrq(c, NULL, 0);
 -      }
 -      return count;
 -}
 -
 -static const struct file_operations proc_sysrq_trigger_operations = {
 -      .write          = write_sysrq_trigger,
 -};
 -#endif
 -
  #ifdef CONFIG_PROC_PAGE_MONITOR
  #define KPMSIZE sizeof(u64)
  #define KPMMASK (KPMSIZE - 1)
@@@ -932,4 -932,7 +930,4 @@@ void __init proc_misc_init(void
  #ifdef CONFIG_PROC_VMCORE
        proc_vmcore = proc_create("vmcore", S_IRUSR, NULL, &proc_vmcore_operations);
  #endif
 -#ifdef CONFIG_MAGIC_SYSRQ
 -      proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
 -#endif
  }
index aae50c2fb303db35d3bab0f2cfdd1a854f1b4fb2,750afada5fbf2b7e1f50f313822d83ada02bb704..380f0b4f17edfcf5c1e1440baed7231e07cdb684
@@@ -17,7 -17,6 +17,6 @@@ static inline cpumask_t target_cpus(voi
        return cpumask_of_cpu(smp_processor_id());
  #endif
  }
- #define TARGET_CPUS   (target_cpus())
  
  #if defined CONFIG_ES7000_CLUSTERED_APIC
  #define APIC_DFR_VALUE                (APIC_DFR_CLUSTER)
@@@ -81,7 -80,7 +80,7 @@@ static inline void setup_apic_routing(v
        int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
        printk("Enabling APIC mode:  %s.  Using %d I/O APICs, target cpus %lx\n",
                (apic_version[apic] == 0x14) ?
-               "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]);
+               "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(target_cpus())[0]);
  }
  
  static inline int multi_timer_check(int apic, int irq)
@@@ -171,7 -170,7 +170,7 @@@ static inline unsigned int cpu_mask_to_
                        int new_apicid = cpu_to_logical_apicid(cpu);
                        if (apicid_cluster(apicid) !=
                                        apicid_cluster(new_apicid)){
 -                              printk ("%s: Not a valid mask!\n",__FUNCTION__);
 +                              printk ("%s: Not a valid mask!\n", __func__);
  #if defined CONFIG_ES7000_CLUSTERED_APIC
                                return 0xFF;
  #else
index 394b00bb5e72542b3bfd4ecc2efbee58157cf3a9,0f68037b8f246c07f6f17da10c7dd608ed1954b3..9b3070f1c2ac6fb80f0b53edf9b33b080af0f081
@@@ -22,7 -22,6 +22,6 @@@ static inline cpumask_t target_cpus(voi
         */
        return cpumask_of_cpu(0);
  }
- #define TARGET_CPUS   (target_cpus())
  
  #define INT_DELIVERY_MODE (dest_LowestPrio)
  #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
@@@ -160,7 -159,7 +159,7 @@@ static inline unsigned int cpu_mask_to_
                        int new_apicid = cpu_to_logical_apicid(cpu);
                        if (apicid_cluster(apicid) !=
                                        apicid_cluster(new_apicid)){
 -                              printk ("%s: Not a valid mask!\n",__FUNCTION__);
 +                              printk ("%s: Not a valid mask!\n", __func__);
                                return 0xFF;
                        }
                        apicid = apicid | new_apicid;
index 35a61dc60d51ac9878ea9ba6fad94b579403f652,72fcfcff5637e1fd2e5b99f746ce7fe70622f727..f58a0cf8929a81fb14025ab8683ab32bf8ab539c
@@@ -8,11 -8,10 +8,12 @@@
  #include <linux/preempt.h>
  #include <linux/cpumask.h>
  #include <linux/irqreturn.h>
+ #include <linux/irqnr.h>
  #include <linux/hardirq.h>
  #include <linux/sched.h>
  #include <linux/irqflags.h>
 +#include <linux/smp.h>
 +#include <linux/percpu.h>
  #include <asm/atomic.h>
  #include <asm/ptrace.h>
  #include <asm/system.h>
@@@ -254,8 -253,6 +255,8 @@@ enu
        HRTIMER_SOFTIRQ,
  #endif
        RCU_SOFTIRQ,    /* Preferable RCU should always be the last softirq */
 +
 +      NR_SOFTIRQS
  };
  
  /* softirq mask and active fields moved to irq_cpustat_t in
@@@ -275,25 -272,6 +276,25 @@@ extern void softirq_init(void)
  extern void raise_softirq_irqoff(unsigned int nr);
  extern void raise_softirq(unsigned int nr);
  
 +/* This is the worklist that queues up per-cpu softirq work.
 + *
 + * send_remote_sendirq() adds work to these lists, and
 + * the softirq handler itself dequeues from them.  The queues
 + * are protected by disabling local cpu interrupts and they must
 + * only be accessed by the local cpu that they are for.
 + */
 +DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
 +
 +/* Try to send a softirq to a remote cpu.  If this cannot be done, the
 + * work will be queued to the local cpu.
 + */
 +extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
 +
 +/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
 + * and compute the current cpu, passed in as 'this_cpu'.
 + */
 +extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
 +                                int this_cpu, int softirq);
  
  /* Tasklets --- multithreaded analogue of BHs.
  
index cac3750cd65e6c1f07b2dc1c4cc8b9f654282726,89b6ecd414731afc3cd0600f90e16f057537af63..4a145caeee075d3209fa4e0d324dfed7f9a15fe7
@@@ -39,20 -39,33 +39,34 @@@ DECLARE_PER_CPU(struct kernel_stat, kst
  
  extern unsigned long long nr_context_switches(void);
  
+ struct irq_desc;
+ static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
+                                           struct irq_desc *desc)
+ {
+       kstat_this_cpu.irqs[irq]++;
+ }
+ static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
+ {
+        return kstat_cpu(cpu).irqs[irq];
+ }
  /*
   * Number of interrupts per specific IRQ source, since bootup
   */
- static inline int kstat_irqs(int irq)
+ static inline unsigned int kstat_irqs(unsigned int irq)
  {
-       int cpu, sum = 0;
+       unsigned int sum = 0;
+       int cpu;
  
        for_each_possible_cpu(cpu)
-               sum += kstat_cpu(cpu).irqs[irq];
+               sum += kstat_irqs_cpu(irq, cpu);
  
        return sum;
  }
  
 +extern unsigned long long task_delta_exec(struct task_struct *);
  extern void account_user_time(struct task_struct *, cputime_t);
  extern void account_user_time_scaled(struct task_struct *, cputime_t);
  extern void account_system_time(struct task_struct *, int, cputime_t);
diff --combined include/linux/pci.h
index acf8f24037cd0cd261772e23cbf8d86386318f2d,1f8db240ca48e924a323e5f9bfc422bc333465cf..7f3f65ee4da761e58c2198d53db6b5cbde3e80e9
@@@ -631,8 -631,6 +631,8 @@@ int __must_check pci_assign_resource(st
  int pci_select_bars(struct pci_dev *dev, unsigned long flags);
  
  /* ROM control related routines */
 +int pci_enable_rom(struct pci_dev *pdev);
 +void pci_disable_rom(struct pci_dev *pdev);
  void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
  void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
  size_t pci_get_rom_size(void __iomem *rom, size_t size);
@@@ -725,7 -723,7 +725,7 @@@ enum pci_dma_burst_strategy 
  };
  
  struct msix_entry {
-       u16     vector; /* kernel uses to write allocated vector */
+       u32     vector; /* kernel uses to write allocated vector */
        u16     entry;  /* driver uses to specify entry, OS writes */
  };