For aesthetics, rename these register defines to give them namespace associated with the driver and define the bits in the 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 | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 3ba4da6..106fd51 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -68,6 +68,16 @@ #define DAQ700_CMD1_EXTINTEN (1 << 5) #define DAQ700_CMD1_FIFOINTEN (1 << 4) #define DAQ700_CMD1_MA(x) ((x) << 0) +#define DAQ700_STATUS1_REG 0x00 +#define DAQ700_STATUS1_FIFOHF (1 << 6) +#define DAQ700_STATUS1_CONVPROG (1 << 4) +#define DAQ700_STATUS1_EXTINT (1 << 3) +#define DAQ700_STATUS1_CNTINT (1 << 2) +#define DAQ700_STATUS1_DATAERR (1 << 1) +#define DAQ700_STATUS1_DAVAIL (1 << 0) +#define DAQ700_STATUS2_REG 0x01 +#define DAQ700_STATUS2_OVERFLOW (1 << 1) +#define DAQ700_STATUS2_OVERRUN (1 << 0) #define DAQ700_DO_REG 0x04 #define DAQ700_DI_REG 0x05 #define DAQ700_CMD3_REG 0x05 @@ -81,8 +91,6 @@ #define DAQ700_TIMER_BASE 0x08 /* daqcard700 registers */ -#define STA_R1 0x00 /* RO 8bit */ -#define STA_R2 0x01 /* RO 8bit */ #define ADFIFO_R 0x02 /* RO 16bit */ #define ADCLEAR_R 0x01 /* WO 8bit */ #define TIC_R 0x06 /* WO 8bit */ @@ -161,14 +169,18 @@ static int daq700_ai_eoc(struct comedi_device *dev, { unsigned int status; - status = inb(dev->iobase + STA_R2); - if ((status & 0x03)) + status = inb(dev->iobase + DAQ700_STATUS2_REG); + if (status & (DAQ700_STATUS2_OVERFLOW | DAQ700_STATUS2_OVERRUN)) return -EOVERFLOW; - status = inb(dev->iobase + STA_R1); - if ((status & 0x02)) + + status = inb(dev->iobase + DAQ700_STATUS1_REG); + if (status & DAQ700_STATUS1_DATAERR) return -ENODATA; - if ((status & 0x11) == 0x01) + + status &= (DAQ700_STATUS1_CONVPROG | DAQ700_STATUS1_DAVAIL); + if (status == DAQ700_STATUS1_DAVAIL) return 0; + return -EBUSY; } -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel