Commit 34248192 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi-data: remove 'allocated' from the private data

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0fcdafb8
......@@ -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);
}
}
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment