Merge branch 'linus' into timers/hpet
authorIngo Molnar <mingo@elte.hu>
Thu, 31 Jul 2008 16:43:41 +0000 (18:43 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 31 Jul 2008 16:43:41 +0000 (18:43 +0200)
1  2 
Documentation/00-INDEX
drivers/char/hpet.c

diff --combined Documentation/00-INDEX
@@@ -161,6 -161,8 +161,6 @@@ hayes-esp.tx
        - info on using the Hayes ESP serial driver.
  highuid.txt
        - notes on the change from 16 bit to 32 bit user/group IDs.
 -hpet.txt
 -      - High Precision Event Timer Driver for Linux.
  timers/
        - info on the timer related topics
  hw_random.txt
@@@ -359,8 -361,6 +359,6 @@@ telephony
        - directory with info on telephony (e.g. voice over IP) support.
  time_interpolators.txt
        - info on time interpolators.
- tipar.txt
-       - information about Parallel link cable for Texas Instruments handhelds.
  tty.txt
        - guide to the locking policies of the tty layer.
  uml/
diff --combined drivers/char/hpet.c
@@@ -14,6 -14,7 +14,7 @@@
  #include <linux/interrupt.h>
  #include <linux/module.h>
  #include <linux/kernel.h>
+ #include <linux/smp_lock.h>
  #include <linux/types.h>
  #include <linux/miscdevice.h>
  #include <linux/major.h>
@@@ -184,67 -185,6 +185,67 @@@ static irqreturn_t hpet_interrupt(int i
        return IRQ_HANDLED;
  }
  
 +static void hpet_timer_set_irq(struct hpet_dev *devp)
 +{
 +      unsigned long v;
 +      int irq, gsi;
 +      struct hpet_timer __iomem *timer;
 +
 +      spin_lock_irq(&hpet_lock);
 +      if (devp->hd_hdwirq) {
 +              spin_unlock_irq(&hpet_lock);
 +              return;
 +      }
 +
 +      timer = devp->hd_timer;
 +
 +      /* we prefer level triggered mode */
 +      v = readl(&timer->hpet_config);
 +      if (!(v & Tn_INT_TYPE_CNF_MASK)) {
 +              v |= Tn_INT_TYPE_CNF_MASK;
 +              writel(v, &timer->hpet_config);
 +      }
 +      spin_unlock_irq(&hpet_lock);
 +
 +      v = (readq(&timer->hpet_config) & Tn_INT_ROUTE_CAP_MASK) >>
 +                               Tn_INT_ROUTE_CAP_SHIFT;
 +
 +      /*
 +       * In PIC mode, skip IRQ0-4, IRQ6-9, IRQ12-15 which is always used by
 +       * legacy device. In IO APIC mode, we skip all the legacy IRQS.
 +       */
 +      if (acpi_irq_model == ACPI_IRQ_MODEL_PIC)
 +              v &= ~0xf3df;
 +      else
 +              v &= ~0xffff;
 +
 +      for (irq = find_first_bit(&v, HPET_MAX_IRQ); irq < HPET_MAX_IRQ;
 +              irq = find_next_bit(&v, HPET_MAX_IRQ, 1 + irq)) {
 +
 +              if (irq >= NR_IRQS) {
 +                      irq = HPET_MAX_IRQ;
 +                      break;
 +              }
 +
 +              gsi = acpi_register_gsi(irq, ACPI_LEVEL_SENSITIVE,
 +                                      ACPI_ACTIVE_LOW);
 +              if (gsi > 0)
 +                      break;
 +
 +              /* FIXME: Setup interrupt source table */
 +      }
 +
 +      if (irq < HPET_MAX_IRQ) {
 +              spin_lock_irq(&hpet_lock);
 +              v = readl(&timer->hpet_config);
 +              v |= irq << Tn_INT_ROUTE_CNF_SHIFT;
 +              writel(v, &timer->hpet_config);
 +              devp->hd_hdwirq = gsi;
 +              spin_unlock_irq(&hpet_lock);
 +      }
 +      return;
 +}
 +
  static int hpet_open(struct inode *inode, struct file *file)
  {
        struct hpet_dev *devp;
        if (file->f_mode & FMODE_WRITE)
                return -EINVAL;
  
+       lock_kernel();
        spin_lock_irq(&hpet_lock);
  
        for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next)
  
        if (!devp) {
                spin_unlock_irq(&hpet_lock);
+               unlock_kernel();
                return -EBUSY;
        }
  
        devp->hd_irqdata = 0;
        devp->hd_flags |= HPET_OPEN;
        spin_unlock_irq(&hpet_lock);
+       unlock_kernel();
  
 +      hpet_timer_set_irq(devp);
 +
        return 0;
  }
  
@@@ -682,6 -623,7 +686,7 @@@ static inline int hpet_tpcheck(struct h
        return -ENXIO;
  }
  
+ #if 0
  int hpet_unregister(struct hpet_task *tp)
  {
        struct hpet_dev *devp;
  
        return 0;
  }
+ #endif  /*  0  */
  
  static ctl_table hpet_table[] = {
        {