From: H Hartley Sweeten Date: Mon, 10 Mar 2014 21:07:32 +0000 (-0700) Subject: staging: comedi: c6xdigio: define the register map X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=721869e85594de3e94e4be900c734b02f6c3ecad;p=linux-beck.git staging: comedi: c6xdigio: define the register map The register map was already defined but it was not being used. Rename to defines and use them in the code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index 2189e5bc316f..a05196b56ed4 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -44,11 +44,12 @@ http://robot0.ge.uiuc.edu/~spong/mecha/ #include "../comedidev.h" /* - * port offsets + * Register I/O map */ -#define C6XDIGIO_PARALLEL_DATA 0 -#define C6XDIGIO_PARALLEL_STATUS 1 -#define C6XDIGIO_PARALLEL_CONTROL 2 +#define C6XDIGIO_DATA_REG 0x00 +#define C6XDIGIO_STATUS_REG 0x01 +#define C6XDIGIO_CTRL_REG 0x02 + struct pwmbitstype { unsigned sb0:2; unsigned sb1:2; @@ -83,7 +84,7 @@ static int c6xdigio_chk_status(struct comedi_device *dev, unsigned long context) int timeout = 0; do { - status = inb(dev->iobase + 1); + status = inb(dev->iobase + C6XDIGIO_STATUS_REG); if ((status & 0x80) != context) return 0; timeout++; @@ -95,7 +96,7 @@ static int c6xdigio_chk_status(struct comedi_device *dev, unsigned long context) static int c6xdigio_write_data(struct comedi_device *dev, unsigned int val, unsigned int status) { - outb_p(val, dev->iobase); + outb_p(val, dev->iobase + C6XDIGIO_DATA_REG); return c6xdigio_chk_status(dev, status); } @@ -146,28 +147,28 @@ static int c6xdigio_encoder_read(struct comedi_device *dev, c6xdigio_write_data(dev, ppcmd, 0x00); - enc.bits.sb0 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb0 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd + 0x4, 0x80); - enc.bits.sb1 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb1 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd, 0x00); - enc.bits.sb2 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb2 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd + 0x4, 0x80); - enc.bits.sb3 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb3 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd, 0x00); - enc.bits.sb4 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb4 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd + 0x4, 0x80); - enc.bits.sb5 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb5 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd, 0x00); - enc.bits.sb6 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb6 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd + 0x4, 0x80); - enc.bits.sb7 = ((inb(dev->iobase + 1) >> 3) & 0x7); + enc.bits.sb7 = ((inb(dev->iobase + C6XDIGIO_STATUS_REG) >> 3) & 0x7); c6xdigio_write_data(dev, ppcmd, 0x00); c6xdigio_write_data(dev, 0x00, 0x80);