]> Pileus Git - ~andy/linux/commitdiff
staging: comedi: addi-data: remove 'allocated' from the private data
authorH Hartley Sweeten <hartleys@visionengravers.com>
Wed, 31 Oct 2012 23:58:09 +0000 (16:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Nov 2012 15:43:25 +0000 (08:43 -0700)
This variable is only used as a flag to indicate that the pci device
has been enabled. Use the comedi_device 'iobase' variable to indicate
this instead. This is how it's normally handled in the comedi pci
drivers.

Make the call to comedi_pci_disabled() in i_ADDI_Detach() common
and move it to the end of the function. Both the if and else case
require it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi-data/addi_common.c
drivers/staging/comedi/drivers/addi-data/addi_common.h

index a9295f2d2a5b5b7ec63676e95a6067f819538ef2..02d1015f3b992f7cbd419d88276fee385a5be876 100644 (file)
@@ -118,7 +118,6 @@ static int addi_attach_pci(struct comedi_device *dev,
                return ret;
        if (this_board->i_Dma)
                pci_set_master(pcidev);
-       devpriv->allocated = 1;
 
        if (!this_board->pc_EepromChip ||
            !strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {
@@ -385,8 +384,6 @@ static void i_ADDI_Detach(struct comedi_device *dev)
                        free_irq(dev->irq, dev);
                if ((this_board->pc_EepromChip == NULL) ||
                    (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
-                       if (devpriv->allocated)
-                               comedi_pci_disable(pcidev);
                        if (devpriv->ul_DmaBufferVirtual[0]) {
                                free_pages((unsigned long)devpriv->
                                        ul_DmaBufferVirtual[0],
@@ -399,8 +396,10 @@ static void i_ADDI_Detach(struct comedi_device *dev)
                        }
                } else {
                        iounmap(devpriv->dw_AiBase);
-                       if (devpriv->allocated)
-                               comedi_pci_disable(pcidev);
                }
        }
+       if (pcidev) {
+               if (dev->iobase)
+                       comedi_pci_disable(pcidev);
+       }
 }
index c72e79d2c27dcc2ccbcc745ff30182b28f668ef4..2773359e54e35869dccee38676128082259fa13a 100644 (file)
@@ -312,7 +312,6 @@ struct addi_private {
        int i_IobaseAddon;      /* addon base address */
        int i_IobaseReserved;
        void __iomem *dw_AiBase;
-       unsigned char allocated;                /*  we have blocked card */
        unsigned char b_ValidDriver;    /*  driver is ok */
        unsigned char b_AiContinuous;   /*  we do unlimited AI */
        unsigned char b_AiInitialisation;