This board has 8 digital output and 8 digital input channels. For convienence all 16 channels are packed into one DIO subdevice. Add a comment to clarify this. Tidy up the 'mask' check used when updating the digital outputs. For aesthetics, rename the digital output and digital input registers. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/ni_daq_700.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index ba22951..1798b47 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -61,11 +61,11 @@ /* * Regsiter I/O map */ +#define DAQ700_DO_REG 0x04 +#define DAQ700_DI_REG 0x05 #define DAQ700_TIMER_BASE 0x08 /* daqcard700 registers */ -#define DIO_W 0x04 /* WO 8bit */ -#define DIO_R 0x05 /* RO 8bit */ #define CMD_R1 0x00 /* WO 8bit */ #define CMD_R2 0x07 /* RW 8bit */ #define CMD_R3 0x05 /* W0 8bit */ @@ -94,14 +94,16 @@ static int daq700_dio_insn_bits(struct comedi_device *dev, unsigned int mask; unsigned int val; + /* + * channels 0-7 are always outputs + * channels 8-15 are always inputs + */ mask = comedi_dio_update_state(s, data); - if (mask) { - if (mask & 0xff) - outb(s->state & 0xff, dev->iobase + DIO_W); - } + if (mask & 0xff) + outb(s->state & 0xff, dev->iobase + DAQ700_DO_REG); val = s->state & 0xff; - val |= inb(dev->iobase + DIO_R) << 8; + val |= inb(dev->iobase + DAQ700_DI_REG) << 8; data[1] = val; -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel