Skip to content

Commit

Permalink
staging: comedi: addi-data: remove 'allocated' from the private data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Nov 1, 2012
1 parent 0fcdafb commit 3424819
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions drivers/staging/comedi/drivers/addi-data/addi_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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],
Expand All @@ -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);
}
}
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/addi-data/addi_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3424819

Please sign in to comment.