[PATCH 39/46] staging: comedi: adl_pci9111: remove unnecessary 'is_valid'

H Hartley Sweeten hartleys at visionengravers.com
Tue Sep 11 02:04:57 UTC 2012


The 'is_valid' variable in the private data is only used in the
detach of the board to determine if the pci9111_reset() function
can be called. That function only requires a valid dev->iobase
to work. Use that for the check instead and remove the unneeded
variable from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/adl_pci9111.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index fe55029..7cf015e 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -149,8 +149,6 @@ struct pci9111_private_data {
 	unsigned int div1;
 	unsigned int div2;
 
-	int is_valid;		/*  Is device valid */
-
 	short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE];
 };
 
@@ -1020,8 +1018,6 @@ static int pci9111_attach_pci(struct comedi_device *dev,
 	s->range_table	= &range_digital;
 	s->insn_bits	= pci9111_do_insn_bits;
 
-	dev_private->is_valid = 1;
-
 	dev_info(dev->class_dev, "%s attached\n", dev->board_name);
 
 	return 0;
@@ -1030,12 +1026,9 @@ static int pci9111_attach_pci(struct comedi_device *dev,
 static void pci9111_detach(struct comedi_device *dev)
 {
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-	struct pci9111_private_data *dev_private = dev->private;
 
-	if (dev_private) {
-		if (dev_private->is_valid)
-			pci9111_reset(dev);
-	}
+	if (dev->iobase)
+		pci9111_reset(dev);
 	if (dev->irq != 0)
 		free_irq(dev->irq, dev);
 	if (pcidev) {
-- 
1.7.11




More information about the devel mailing list