diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-07-12 17:46:37 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 19:08:22 -0700 |
commit | d254eb7418e389e063831d8d77b7dac240288f02 (patch) | |
tree | bf0969af267d538079d3a4fff648ba71fa64e82a | |
parent | b70ac75eeff0fb1f356924e58f6f543c9b3d3077 (diff) |
staging: comedi: dt282x: remove the outw wrapper macros
The macros 'update_dacsr', 'update_adcsr', and 'update_supcsr' all use
the 'devpriv' macro which uses a local variable of a specific name and
yeilds a pointer derived from that name. They are also just wrappers
around simple 'outw' calls. Remove the macros.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/dt282x.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 4af33431c38..1f0b40e4bdd 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -255,11 +255,8 @@ struct dt282x_private { * Some useless abstractions */ #define chan_to_DAC(a) ((a)&1) -#define update_dacsr(a) outw(devpriv->dacsr|(a), dev->iobase+DT2821_DACSR) -#define update_adcsr(a) outw(devpriv->adcsr|(a), dev->iobase+DT2821_ADCSR) #define mux_busy() (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY) #define ad_done() (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE) -#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) /* * danger! macro abuse... a is the expression to wait on, and b is @@ -317,7 +314,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) int i; struct comedi_subdevice *s = dev->subdevices + 1; - update_supcsr(DT2821_CLRDMADNE); + outw(devpriv->supcsr | DT2821_CLRDMADNE, dev->iobase + DT2821_SUPCSR); if (!s->async->prealloc_buf) { printk(KERN_ERR "async->data disappeared. dang!\n"); @@ -350,7 +347,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) int ret; struct comedi_subdevice *s = dev->subdevices; - update_supcsr(DT2821_CLRDMADNE); + outw(devpriv->supcsr | DT2821_CLRDMADNE, dev->iobase + DT2821_SUPCSR); if (!s->async->prealloc_buf) { printk(KERN_ERR "async->data disappeared. dang!\n"); @@ -387,7 +384,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) /* XXX probably wrong */ if (!devpriv->ntrig) { devpriv->supcsr &= ~(DT2821_DDMA); - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } #endif /* restart the channel */ @@ -513,7 +510,8 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) s->async->events |= COMEDI_CB_EOA; } else { if (supcsr & DT2821_SCDN) - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); } handled = 1; } @@ -534,7 +532,8 @@ static void dt282x_load_changain(struct comedi_device *dev, int n, for (i = 0; i < n; i++) { chan = CR_CHAN(chanlist[i]); range = CR_RANGE(chanlist[i]); - update_adcsr((range << 4) | (chan)); + outw(devpriv->adcsr | (range << 4) | chan, + dev->iobase + DT2821_ADCSR); } outw(n - 1, dev->iobase + DT2821_CHANCSR); } @@ -553,15 +552,16 @@ static int dt282x_ai_insn_read(struct comedi_device *dev, /* XXX should we really be enabling the ad clock here? */ devpriv->adcsr = DT2821_ADCLK; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); dt282x_load_changain(dev, 1, &insn->chanspec); - update_supcsr(DT2821_PRLD); + outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR); wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;); for (i = 0; i < insn->n; i++) { - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); wait_for(ad_done(), comedi_error(dev, "timeout\n"); return -ETIME;); @@ -718,7 +718,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* external trigger */ devpriv->supcsr = DT2821_ERRINTEN | DT2821_DS0 | DT2821_DS1; } - update_supcsr(DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_ADCINIT); + outw(devpriv->supcsr | DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_ADCINIT, + dev->iobase + DT2821_SUPCSR); devpriv->ntrig = cmd->stop_arg * cmd->scan_end_arg; devpriv->nread = devpriv->ntrig; @@ -729,7 +730,7 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->ntrig) { prep_ai_dma(dev, 1, 0); devpriv->supcsr |= DT2821_DDMA; - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } devpriv->adcsr = 0; @@ -737,16 +738,17 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_load_changain(dev, cmd->chanlist_len, cmd->chanlist); devpriv->adcsr = DT2821_ADCLK | DT2821_IADDONE; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); - update_supcsr(DT2821_PRLD); + outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR); wait_for(!mux_busy(), comedi_error(dev, "timeout\n"); return -ETIME;); if (cmd->scan_begin_src == TRIG_FOLLOW) { - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, + dev->iobase + DT2821_SUPCSR); } else { devpriv->supcsr |= DT2821_XTRIG; - update_supcsr(0); + outw(devpriv->supcsr, dev->iobase + DT2821_SUPCSR); } return 0; @@ -766,10 +768,10 @@ static int dt282x_ai_cancel(struct comedi_device *dev, dt282x_disable_dma(dev); devpriv->adcsr = 0; - update_adcsr(0); + outw(devpriv->adcsr, dev->iobase + DT2821_ADCSR); devpriv->supcsr = 0; - update_supcsr(DT2821_ADCINIT); + outw(devpriv->supcsr | DT2821_ADCINIT, dev->iobase + DT2821_SUPCSR); return 0; } @@ -845,11 +847,11 @@ static int dt282x_ao_insn_write(struct comedi_device *dev, d ^= (1 << (boardtype.dabits - 1)); } - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); outw(d, dev->iobase + DT2821_DADAT); - update_supcsr(DT2821_DACON); + outw(devpriv->supcsr | DT2821_DACON, dev->iobase + DT2821_SUPCSR); return 1; } @@ -972,7 +974,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, } prep_ao_dma(dev, 1, size); - update_supcsr(DT2821_STRIG); + outw(devpriv->supcsr | DT2821_STRIG, dev->iobase + DT2821_SUPCSR); s->async->inttrig = NULL; return 1; @@ -993,7 +995,8 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_disable_dma(dev); devpriv->supcsr = DT2821_ERRINTEN | DT2821_DS1 | DT2821_DDMA; - update_supcsr(DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_DACINIT); + outw(devpriv->supcsr | DT2821_CLRDMADNE | DT2821_BUFFB | DT2821_DACINIT, + dev->iobase + DT2821_SUPCSR); devpriv->ntrig = cmd->stop_arg * cmd->chanlist_len; devpriv->nread = devpriv->ntrig; @@ -1005,7 +1008,7 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(timer, dev->iobase + DT2821_TMRCTR); devpriv->dacsr = DT2821_SSEL | DT2821_DACLK | DT2821_IDARDY; - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); s->async->inttrig = dt282x_ao_inttrig; @@ -1018,10 +1021,10 @@ static int dt282x_ao_cancel(struct comedi_device *dev, dt282x_disable_dma(dev); devpriv->dacsr = 0; - update_dacsr(0); + outw(devpriv->dacsr, dev->iobase + DT2821_DACSR); devpriv->supcsr = 0; - update_supcsr(DT2821_DACINIT); + outw(devpriv->supcsr | DT2821_DACINIT, dev->iobase + DT2821_SUPCSR); return 0; } |