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

staging: comedi: adv_pci1723: cleanup card reset

Only one 'reset' of the card is required in the attach. Remove the
one before setting up the subdevices and leave the one before
exiting the attach function.

The 'valid' variable in the private data is not needed. This variable
is used in the detach to determine if it's ok to call the 'reset'
function. Checking if dev->iobase is valid works just as well.
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 5222687a
...@@ -107,12 +107,8 @@ configures all channels in the same group. ...@@ -107,12 +107,8 @@ configures all channels in the same group.
#define PCI1723_SELECT_CALIBRATION 0x28 /* Select the calibration Ref_V */ #define PCI1723_SELECT_CALIBRATION 0x28 /* Select the calibration Ref_V */
/* This structure is for data unique to this hardware driver. */
struct pci1723_private { struct pci1723_private {
int valid; /* card is usable; */
unsigned char da_range[8]; /* D/A output range for each channel */ unsigned char da_range[8]; /* D/A output range for each channel */
short ao_data[8]; /* data output buffer */ short ao_data[8]; /* data output buffer */
}; };
...@@ -262,8 +258,6 @@ static int pci1723_attach_pci(struct comedi_device *dev, ...@@ -262,8 +258,6 @@ static int pci1723_attach_pci(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
pci1723_reset(dev);
s = dev->subdevices + 0; s = dev->subdevices + 0;
dev->write_subdev = s; dev->write_subdev = s;
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
...@@ -303,8 +297,6 @@ static int pci1723_attach_pci(struct comedi_device *dev, ...@@ -303,8 +297,6 @@ static int pci1723_attach_pci(struct comedi_device *dev,
/* read DIO port state */ /* read DIO port state */
s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA); s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA);
devpriv->valid = 1;
pci1723_reset(dev); pci1723_reset(dev);
dev_info(dev->class_dev, "%s attached\n", dev->board_name); dev_info(dev->class_dev, "%s attached\n", dev->board_name);
...@@ -315,16 +307,13 @@ static int pci1723_attach_pci(struct comedi_device *dev, ...@@ -315,16 +307,13 @@ static int pci1723_attach_pci(struct comedi_device *dev,
static void pci1723_detach(struct comedi_device *dev) static void pci1723_detach(struct comedi_device *dev)
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct pci1723_private *devpriv = dev->private;
if (devpriv) {
if (devpriv->valid)
pci1723_reset(dev);
}
if (pcidev) { if (pcidev) {
if (dev->iobase) if (dev->iobase) {
pci1723_reset(dev);
comedi_pci_disable(pcidev); comedi_pci_disable(pcidev);
} }
}
} }
static struct comedi_driver adv_pci1723_driver = { static struct comedi_driver adv_pci1723_driver = {
......
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