Commit 0c917a93 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: adv_pci1710: tidy up pci1710_reset()

Change the return type to void, this function always succeeds and the
caller does not check the return value anyway.

Fix the initial programming of the control register. The SW bit enables
the software trigger and should not be set here. Setting CNT0 selects the
external clock source for counter 0 (the user counter). It makes more
sense to select the internal 1 MHz clock.

Remove the unnecessary initialization of the private data members. This
function is only called during the (*auto_attach) after the private
data was kzalloc'ed.

Remove the redundant clearing of the A/D FIFO and pending interrupts.
Just do it once.
Signed-off-by: default avatarH Hartley Sweeten <>
Reviewed-by: default avatarIan Abbott <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent adbc9ec7
......@@ -711,29 +711,29 @@ static int pci1710_counter_insn_config(struct comedi_device *dev,
return insn->n;
static int pci1710_reset(struct comedi_device *dev)
static void pci1710_reset(struct comedi_device *dev)
const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
/* Software trigger, CNT0=external */
devpriv->ctrl = PCI171X_CTRL_SW | PCI171X_CTRL_CNT0;
/* reset any operations */
outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG);
* Disable A/D triggers and interrupt sources, set counter 0
* to use internal 1 MHz clock.
outw(0, dev->iobase + PCI171X_CTRL_REG);
/* clear A/D FIFO and any pending interrutps */
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
devpriv->da_ranges = 0;
if (board->has_ao) {
/* set DACs to 0..5V and outputs to 0V */
outb(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG);
outb(0, dev->iobase + PCI171X_DAREF_REG);
outw(0, dev->iobase + PCI171X_DA_REG(0));
outw(0, dev->iobase + PCI171X_DA_REG(1));
outw(0, dev->iobase + PCI171X_DO_REG); /* digital outputs to 0 */
outb(0, dev->iobase + PCI171X_CLRFIFO_REG);
outb(0, dev->iobase + PCI171X_CLRINT_REG);
return 0;
/* set digital outputs to 0 */
outw(0, dev->iobase + PCI171X_DO_REG);
static int pci1710_auto_attach(struct comedi_device *dev,
Supports Markdown
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