Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / staging / comedi / drivers / amplc_pc236.c
index c45cbf3..48d7ccb 100644 (file)
@@ -77,19 +77,19 @@ unused.
  * INTCSR values for PCI236.
  */
 /* Disable interrupt, also clear any interrupt there */
-#define PCI236_INTR_DISABLE ( PLX9052_INTCSR_LI1ENAB_DISABLED \
+#define PCI236_INTR_DISABLE (PLX9052_INTCSR_LI1ENAB_DISABLED \
         | PLX9052_INTCSR_LI1POL_HIGH \
         | PLX9052_INTCSR_LI2POL_HIGH \
         | PLX9052_INTCSR_PCIENAB_DISABLED \
         | PLX9052_INTCSR_LI1SEL_EDGE \
-        | PLX9052_INTCSR_LI1CLRINT_ASSERTED )
+        | PLX9052_INTCSR_LI1CLRINT_ASSERTED)
 /* Enable interrupt, also clear any interrupt there. */
-#define PCI236_INTR_ENABLE ( PLX9052_INTCSR_LI1ENAB_ENABLED \
+#define PCI236_INTR_ENABLE (PLX9052_INTCSR_LI1ENAB_ENABLED \
         | PLX9052_INTCSR_LI1POL_HIGH \
         | PLX9052_INTCSR_LI2POL_HIGH \
         | PLX9052_INTCSR_PCIENAB_ENABLED \
         | PLX9052_INTCSR_LI1SEL_EDGE \
-        | PLX9052_INTCSR_LI1CLRINT_ASSERTED )
+        | PLX9052_INTCSR_LI1CLRINT_ASSERTED)
 
 /*
  * Board descriptions for Amplicon PC36AT and PCI236.
@@ -107,27 +107,27 @@ struct pc236_board {
 };
 static const struct pc236_board pc236_boards[] = {
        {
-             name:     "pc36at",
-             fancy_name:"PC36AT",
-             bustype:  isa_bustype,
-             model:    pc36at_model,
+       .name = "pc36at",
+       .fancy_name = "PC36AT",
+       .bustype = isa_bustype,
+       .model = pc36at_model,
                },
 #ifdef CONFIG_COMEDI_PCI
        {
-             name:     "pci236",
-             fancy_name:"PCI236",
-             devid:    PCI_DEVICE_ID_AMPLICON_PCI236,
-             bustype:  pci_bustype,
-             model:    pci236_model,
+       .name = "pci236",
+       .fancy_name = "PCI236",
+       .devid = PCI_DEVICE_ID_AMPLICON_PCI236,
+       .bustype = pci_bustype,
+       .model = pci236_model,
                },
 #endif
 #ifdef CONFIG_COMEDI_PCI
        {
-             name:     PC236_DRIVER_NAME,
-             fancy_name:PC236_DRIVER_NAME,
-             devid:    PCI_DEVICE_ID_INVALID,
-             bustype:  pci_bustype,
-             model:    anypci_model,   /* wildcard */
+       .name = PC236_DRIVER_NAME,
+       .fancy_name = PC236_DRIVER_NAME,
+       .devid = PCI_DEVICE_ID_INVALID,
+       .bustype = pci_bustype,
+       .model = anypci_model,  /* wildcard */
                },
 #endif
 };
@@ -170,13 +170,13 @@ struct pc236_private {
 static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it);
 static int pc236_detach(struct comedi_device *dev);
 static struct comedi_driver driver_amplc_pc236 = {
-      driver_name:PC236_DRIVER_NAME,
-      module:THIS_MODULE,
-      attach:pc236_attach,
-      detach:pc236_detach,
-      board_name:&pc236_boards[0].name,
-      offset:sizeof(struct pc236_board),
-      num_names:sizeof(pc236_boards) / sizeof(struct pc236_board),
+       .driver_name = PC236_DRIVER_NAME,
+       .module = THIS_MODULE,
+       .attach = pc236_attach,
+       .detach = pc236_detach,
+       .board_name = &pc236_boards[0].name,
+       .offset = sizeof(struct pc236_board),
+       .num_names = ARRAY_SIZE(pc236_boards),
 };
 
 #ifdef CONFIG_COMEDI_PCI
@@ -187,15 +187,15 @@ COMEDI_INITCLEANUP(driver_amplc_pc236);
 
 static int pc236_request_region(unsigned minor, unsigned long from,
        unsigned long extent);
-static void pc236_intr_disable(struct comedi_device * dev);
-static void pc236_intr_enable(struct comedi_device * dev);
-static int pc236_intr_check(struct comedi_device * dev);
-static int pc236_intr_insn(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_insn * insn, unsigned int * data);
-static int pc236_intr_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s,
-       struct comedi_cmd * cmd);
-static int pc236_intr_cmd(struct comedi_device * dev, struct comedi_subdevice * s);
-static int pc236_intr_cancel(struct comedi_device * dev, struct comedi_subdevice * s);
+static void pc236_intr_disable(struct comedi_device *dev);
+static void pc236_intr_enable(struct comedi_device *dev);
+static int pc236_intr_check(struct comedi_device *dev);
+static int pc236_intr_insn(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_insn *insn, unsigned int *data);
+static int pc236_intr_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
+       struct comedi_cmd *cmd);
+static int pc236_intr_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
+static int pc236_intr_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
 static irqreturn_t pc236_interrupt(int irq, void *d);
 
 /*
@@ -284,7 +284,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
  * Allocate the private structure area.  alloc_private() is a
  * convenient macro defined in comedidev.h.
  */
-       if ((ret = alloc_private(dev, sizeof(struct pc236_private))) < 0) {
+       ret = alloc_private(dev, sizeof(struct pc236_private));
+       if (ret < 0) {
                printk(KERN_ERR "comedi%d: error! out of memory!\n",
                        dev->minor);
                return ret;
@@ -302,7 +303,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                slot = it->options[1];
                share_irq = 1;
 
-               if ((ret = pc236_find_pci(dev, bus, slot, &pci_dev)) < 0)
+               ret = pc236_find_pci(dev, bus, slot, &pci_dev);
+               if (ret < 0)
                        return ret;
                devpriv->pci_dev = pci_dev;
                break;
@@ -323,7 +325,9 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        /* Enable device and reserve I/O spaces. */
 #ifdef CONFIG_COMEDI_PCI
        if (pci_dev) {
-               if ((ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME)) < 0) {
+
+               ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME);
+               if (ret < 0) {
                        printk(KERN_ERR
                                "comedi%d: error! cannot enable PCI device and request regions!\n",
                                dev->minor);
@@ -346,7 +350,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
  * Allocate the subdevice structures.  alloc_subdevice() is a
  * convenient macro defined in comedidev.h.
  */
-       if ((ret = alloc_subdevices(dev, 2)) < 0) {
+       ret = alloc_subdevices(dev, 2);
+       if (ret < 0) {
                printk(KERN_ERR "comedi%d: error! out of memory!\n",
                        dev->minor);
                return ret;
@@ -354,7 +359,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        s = dev->subdevices + 0;
        /* digital i/o subdevice (8255) */
-       if ((ret = subdev_8255_init(dev, s, NULL, iobase)) < 0) {
+       ret = subdev_8255_init(dev, s, NULL, iobase);
+       if (ret < 0) {
                printk(KERN_ERR "comedi%d: error! out of memory!\n",
                        dev->minor);
                return ret;
@@ -366,7 +372,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        if (irq) {
                unsigned long flags = share_irq ? IRQF_SHARED : 0;
 
-               if (comedi_request_irq(irq, pc236_interrupt, flags,
+               if (request_irq(irq, pc236_interrupt, flags,
                                PC236_DRIVER_NAME, dev) >= 0) {
                        dev->irq = irq;
                        s->type = COMEDI_SUBD_DI;
@@ -415,7 +421,7 @@ static int pc236_detach(struct comedi_device *dev)
                pc236_intr_disable(dev);
        }
        if (dev->irq)
-               comedi_free_irq(dev->irq, dev);
+               free_irq(dev->irq, dev);
        if (dev->subdevices) {
                subdev_8255_cleanup(dev, dev->subdevices + 0);
        }
@@ -465,13 +471,13 @@ static void pc236_intr_disable(struct comedi_device *dev)
 {
        unsigned long flags;
 
-       comedi_spin_lock_irqsave(&dev->spinlock, flags);
+       spin_lock_irqsave(&dev->spinlock, flags);
        devpriv->enable_irq = 0;
 #ifdef CONFIG_COMEDI_PCI
        if (devpriv->lcr_iobase)
                outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
 #endif
-       comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
+       spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
 /*
@@ -483,13 +489,13 @@ static void pc236_intr_enable(struct comedi_device *dev)
 {
        unsigned long flags;
 
-       comedi_spin_lock_irqsave(&dev->spinlock, flags);
+       spin_lock_irqsave(&dev->spinlock, flags);
        devpriv->enable_irq = 1;
 #ifdef CONFIG_COMEDI_PCI
        if (devpriv->lcr_iobase)
                outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
 #endif
-       comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
+       spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
 /*
@@ -504,7 +510,7 @@ static int pc236_intr_check(struct comedi_device *dev)
        int retval = 0;
        unsigned long flags;
 
-       comedi_spin_lock_irqsave(&dev->spinlock, flags);
+       spin_lock_irqsave(&dev->spinlock, flags);
        if (devpriv->enable_irq) {
                retval = 1;
 #ifdef CONFIG_COMEDI_PCI
@@ -521,7 +527,7 @@ static int pc236_intr_check(struct comedi_device *dev)
                }
 #endif
        }
-       comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
+       spin_unlock_irqrestore(&dev->spinlock, flags);
 
        return retval;
 }