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

staging: comedi: s526: remove ADDR_CHAN_REG macro

This macro relies on a local variable having a specific name.
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 0171e6f5
...@@ -197,8 +197,6 @@ static const struct s526_board s526_boards[] = { ...@@ -197,8 +197,6 @@ static const struct s526_board s526_boards[] = {
} }
}; };
#define ADDR_CHAN_REG(reg, chan) (dev->iobase + (reg) + (chan) * 8)
/* this structure is for data unique to this hardware driver. If /* this structure is for data unique to this hardware driver. If
several hardware drivers keep similar information in this structure, several hardware drivers keep similar information in this structure,
feel free to suggest moving the variable to the struct comedi_device feel free to suggest moving the variable to the struct comedi_device
...@@ -226,8 +224,8 @@ static int s526_gpct_rinsn(struct comedi_device *dev, ...@@ -226,8 +224,8 @@ static int s526_gpct_rinsn(struct comedi_device *dev,
} }
/* Read the low word first */ /* Read the low word first */
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
datalow = inw(ADDR_CHAN_REG(REG_C0L, counter_channel)); datalow = inw(dev->iobase + REG_C0L + counter_channel * 8);
datahigh = inw(ADDR_CHAN_REG(REG_C0H, counter_channel)); datahigh = inw(dev->iobase + REG_C0H + counter_channel * 8);
data[i] = (int)(datahigh & 0x00FF); data[i] = (int)(datahigh & 0x00FF);
data[i] = (data[i] << 16) | (datalow & 0xFFFF); data[i] = (data[i] << 16) | (datalow & 0xFFFF);
/* printk("s526 GPCT[%d]: %x(0x%04x, 0x%04x)\n", /* printk("s526 GPCT[%d]: %x(0x%04x, 0x%04x)\n",
...@@ -283,18 +281,18 @@ static int s526_gpct_insn_config(struct comedi_device *dev, ...@@ -283,18 +281,18 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.preloadRegSel = 0; /* PR0 */
cmReg.reg.reserved = 0; cmReg.reg.reserved = 0;
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
outw(0x0001, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(0x0001, dev->iobase + REG_C0H + subdev_channel * 8);
outw(0x3C68, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(0x3C68, dev->iobase + REG_C0L + subdev_channel * 8);
/* Reset the counter */ /* Reset the counter */
outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x8000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Load the counter from PR0 */ /* Load the counter from PR0 */
outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x4000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Reset RCAP (fires one-shot) */ /* Reset RCAP (fires one-shot) */
outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x0008, dev->iobase + REG_C0C + subdev_channel * 8);
#endif #endif
...@@ -303,14 +301,14 @@ static int s526_gpct_insn_config(struct comedi_device *dev, ...@@ -303,14 +301,14 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
cmReg.value = data[1] & 0xFFFF; cmReg.value = data[1] & 0xFFFF;
/* printk("s526: Counter Mode register=%x\n", cmReg.value); */ /* printk("s526: Counter Mode register=%x\n", cmReg.value); */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Reset the counter if it is software preload */ /* Reset the counter if it is software preload */
if (cmReg.reg.autoLoadResetRcap == 0) { if (cmReg.reg.autoLoadResetRcap == 0) {
/* Reset the counter */ /* Reset the counter */
outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x8000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Load the counter from PR0 /* Load the counter from PR0
* outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); * outw(0x4000, dev->iobase + REG_C0C + subdev_channel * 8);
*/ */
} }
#else #else
...@@ -338,27 +336,27 @@ static int s526_gpct_insn_config(struct comedi_device *dev, ...@@ -338,27 +336,27 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
/* Set Counter Mode Register */ /* Set Counter Mode Register */
cmReg.value = (short)(data[1] & 0xFFFF); cmReg.value = (short)(data[1] & 0xFFFF);
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Load the pre-load register high word */ /* Load the pre-load register high word */
value = (short)((data[2] >> 16) & 0xFFFF); value = (short)((data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
/* Load the pre-load register low word */ /* Load the pre-load register low word */
value = (short)(data[2] & 0xFFFF); value = (short)(data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
/* Write the Counter Control Register */ /* Write the Counter Control Register */
if (data[3] != 0) { if (data[3] != 0) {
value = (short)(data[3] & 0xFFFF); value = (short)(data[3] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(value, dev->iobase + REG_C0C + subdev_channel * 8);
} }
/* Reset the counter if it is software preload */ /* Reset the counter if it is software preload */
if (cmReg.reg.autoLoadResetRcap == 0) { if (cmReg.reg.autoLoadResetRcap == 0) {
/* Reset the counter */ /* Reset the counter */
outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x8000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Load the counter from PR0 */ /* Load the counter from PR0 */
outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x4000, dev->iobase + REG_C0C + subdev_channel * 8);
} }
#endif #endif
break; break;
...@@ -378,33 +376,33 @@ static int s526_gpct_insn_config(struct comedi_device *dev, ...@@ -378,33 +376,33 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
/* Set Counter Mode Register */ /* Set Counter Mode Register */
cmReg.value = (short)(data[1] & 0xFFFF); cmReg.value = (short)(data[1] & 0xFFFF);
cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.preloadRegSel = 0; /* PR0 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Load the pre-load register 0 high word */ /* Load the pre-load register 0 high word */
value = (short)((data[2] >> 16) & 0xFFFF); value = (short)((data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
/* Load the pre-load register 0 low word */ /* Load the pre-load register 0 low word */
value = (short)(data[2] & 0xFFFF); value = (short)(data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
/* Set Counter Mode Register */ /* Set Counter Mode Register */
cmReg.value = (short)(data[1] & 0xFFFF); cmReg.value = (short)(data[1] & 0xFFFF);
cmReg.reg.preloadRegSel = 1; /* PR1 */ cmReg.reg.preloadRegSel = 1; /* PR1 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Load the pre-load register 1 high word */ /* Load the pre-load register 1 high word */
value = (short)((data[3] >> 16) & 0xFFFF); value = (short)((data[3] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
/* Load the pre-load register 1 low word */ /* Load the pre-load register 1 low word */
value = (short)(data[3] & 0xFFFF); value = (short)(data[3] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
/* Write the Counter Control Register */ /* Write the Counter Control Register */
if (data[4] != 0) { if (data[4] != 0) {
value = (short)(data[4] & 0xFFFF); value = (short)(data[4] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(value, dev->iobase + REG_C0C + subdev_channel * 8);
} }
break; break;
...@@ -423,33 +421,33 @@ static int s526_gpct_insn_config(struct comedi_device *dev, ...@@ -423,33 +421,33 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
/* Set Counter Mode Register */ /* Set Counter Mode Register */
cmReg.value = (short)(data[1] & 0xFFFF); cmReg.value = (short)(data[1] & 0xFFFF);
cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.preloadRegSel = 0; /* PR0 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Load the pre-load register 0 high word */ /* Load the pre-load register 0 high word */
value = (short)((data[2] >> 16) & 0xFFFF); value = (short)((data[2] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
/* Load the pre-load register 0 low word */ /* Load the pre-load register 0 low word */
value = (short)(data[2] & 0xFFFF); value = (short)(data[2] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
/* Set Counter Mode Register */ /* Set Counter Mode Register */
cmReg.value = (short)(data[1] & 0xFFFF); cmReg.value = (short)(data[1] & 0xFFFF);
cmReg.reg.preloadRegSel = 1; /* PR1 */ cmReg.reg.preloadRegSel = 1; /* PR1 */
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
/* Load the pre-load register 1 high word */ /* Load the pre-load register 1 high word */
value = (short)((data[3] >> 16) & 0xFFFF); value = (short)((data[3] >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
/* Load the pre-load register 1 low word */ /* Load the pre-load register 1 low word */
value = (short)(data[3] & 0xFFFF); value = (short)(data[3] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
/* Write the Counter Control Register */ /* Write the Counter Control Register */
if (data[4] != 0) { if (data[4] != 0) {
value = (short)(data[4] & 0xFFFF); value = (short)(data[4] & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(value, dev->iobase + REG_C0C + subdev_channel * 8);
} }
break; break;
...@@ -473,22 +471,22 @@ static int s526_gpct_winsn(struct comedi_device *dev, ...@@ -473,22 +471,22 @@ static int s526_gpct_winsn(struct comedi_device *dev,
printk(KERN_INFO "s526: GPCT_INSN_WRITE on channel %d\n", printk(KERN_INFO "s526: GPCT_INSN_WRITE on channel %d\n",
subdev_channel); subdev_channel);
cmReg.value = inw(ADDR_CHAN_REG(REG_C0M, subdev_channel)); cmReg.value = inw(dev->iobase + REG_C0M + subdev_channel * 8);
printk(KERN_INFO "s526: Counter Mode Register: %x\n", cmReg.value); printk(KERN_INFO "s526: Counter Mode Register: %x\n", cmReg.value);
/* Check what Application of Counter this channel is configured for */ /* Check what Application of Counter this channel is configured for */
switch (devpriv->s526_gpct_config[subdev_channel].app) { switch (devpriv->s526_gpct_config[subdev_channel].app) {
case PositionMeasurement: case PositionMeasurement:
printk(KERN_INFO "S526: INSN_WRITE: PM\n"); printk(KERN_INFO "S526: INSN_WRITE: PM\n");
outw(0xFFFF & ((*data) >> 16), ADDR_CHAN_REG(REG_C0H, outw(0xFFFF & ((*data) >> 16), dev->iobase + REG_C0H +
subdev_channel)); subdev_channel * 8);
outw(0xFFFF & (*data), ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(0xFFFF & (*data), dev->iobase + REG_C0L + subdev_channel * 8);
break; break;
case SinglePulseGeneration: case SinglePulseGeneration:
printk(KERN_INFO "S526: INSN_WRITE: SPG\n"); printk(KERN_INFO "S526: INSN_WRITE: SPG\n");
outw(0xFFFF & ((*data) >> 16), ADDR_CHAN_REG(REG_C0H, outw(0xFFFF & ((*data) >> 16), dev->iobase + REG_C0H +
subdev_channel)); subdev_channel * 8);
outw(0xFFFF & (*data), ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(0xFFFF & (*data), dev->iobase + REG_C0L + subdev_channel * 8);
break; break;
case PulseTrainGeneration: case PulseTrainGeneration:
...@@ -511,9 +509,9 @@ static int s526_gpct_winsn(struct comedi_device *dev, ...@@ -511,9 +509,9 @@ static int s526_gpct_winsn(struct comedi_device *dev,
} }
value = (short)((*data >> 16) & 0xFFFF); value = (short)((*data >> 16) & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(value, dev->iobase + REG_C0H + subdev_channel * 8);
value = (short)(*data & 0xFFFF); value = (short)(*data & 0xFFFF);
outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(value, dev->iobase + REG_C0L + subdev_channel * 8);
break; break;
default: /* Impossible */ default: /* Impossible */
printk printk
...@@ -843,17 +841,17 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -843,17 +841,17 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.preloadRegSel = 0; /* PR0 */
cmReg.reg.reserved = 0; cmReg.reg.reserved = 0;
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); outw(cmReg.value, dev->iobase + REG_C0M + subdev_channel * 8);
outw(0x0001, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(0x0001, dev->iobase + REG_C0H + subdev_channel * 8);
outw(0x3C68, ADDR_CHAN_REG(REG_C0L, subdev_channel)); outw(0x3C68, dev->iobase + REG_C0L + subdev_channel * 8);
/* Reset the counter */ /* Reset the counter */
outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x8000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Load the counter from PR0 */ /* Load the counter from PR0 */
outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x4000, dev->iobase + REG_C0C + subdev_channel * 8);
/* Reset RCAP (fires one-shot) */ /* Reset RCAP (fires one-shot) */
outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); outw(0x0008, dev->iobase + REG_C0C + subdev_channel * 8);
#else #else
...@@ -872,35 +870,35 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -872,35 +870,35 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
n = 0; n = 0;
printk(KERN_INFO "Mode reg=0x%04x, 0x%04lx\n", printk(KERN_INFO "Mode reg=0x%04x, 0x%04lx\n",
cmReg.value, ADDR_CHAN_REG(REG_C0M, n)); cmReg.value, dev->iobase + REG_C0M + n * 8);
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, n)); outw(cmReg.value, dev->iobase + REG_C0M + n * 8);
udelay(1000); udelay(1000);
printk(KERN_INFO "Read back mode reg=0x%04x\n", printk(KERN_INFO "Read back mode reg=0x%04x\n",
inw(ADDR_CHAN_REG(REG_C0M, n))); inw(dev->iobase + REG_C0M + n * 8));
/* Load the pre-load register high word */ /* Load the pre-load register high word */
/* value = (short) (0x55); */ /* value = (short) (0x55); */
/* outw(value, ADDR_CHAN_REG(REG_C0H, n)); */ /* outw(value, dev->iobase + REG_C0H + n * 8); */
/* Load the pre-load register low word */ /* Load the pre-load register low word */
/* value = (short)(0xaa55); */ /* value = (short)(0xaa55); */
/* outw(value, ADDR_CHAN_REG(REG_C0L, n)); */ /* outw(value, dev->iobase + REG_C0L + n * 8); */
/* Write the Counter Control Register */ /* Write the Counter Control Register */
/* outw(value, ADDR_CHAN_REG(REG_C0C, 0)); */ /* outw(value, dev->iobase + REG_C0C + 0 * 8); */
/* Reset the counter if it is software preload */ /* Reset the counter if it is software preload */
if (cmReg.reg.autoLoadResetRcap == 0) { if (cmReg.reg.autoLoadResetRcap == 0) {
/* Reset the counter */ /* Reset the counter */
outw(0x8000, ADDR_CHAN_REG(REG_C0C, n)); outw(0x8000, dev->iobase + REG_C0C + n * 8);
/* Load the counter from PR0 */ /* Load the counter from PR0 */
outw(0x4000, ADDR_CHAN_REG(REG_C0C, n)); outw(0x4000, dev->iobase + REG_C0C + n * 8);
} }
outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, n)); outw(cmReg.value, dev->iobase + REG_C0M + n * 8);
udelay(1000); udelay(1000);
printk(KERN_INFO "Read back mode reg=0x%04x\n", printk(KERN_INFO "Read back mode reg=0x%04x\n",
inw(ADDR_CHAN_REG(REG_C0M, n))); inw(dev->iobase + REG_C0M + n * 8));
#endif #endif
printk(KERN_INFO "Current registres:\n"); printk(KERN_INFO "Current registres:\n");
......
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