diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-10-14 02:47:35 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-17 08:20:10 +0200 |
commit | 19aab073245923e8b8b4876dbc2d0287e9e9f700 (patch) | |
tree | b16ae7611042753f373c85c962d38b72682a6a50 | |
parent | staging: comedi: cb_pcidas: tidy up PCI BAR4 register defines (diff) | |
download | linux-19aab073245923e8b8b4876dbc2d0287e9e9f700.tar.xz linux-19aab073245923e8b8b4876dbc2d0287e9e9f700.zip |
staging: comedi: cb_pcidas: use comedi_range_is_unipolar()
Instead of relying on the IS_UNIPOLAR mask value, use the comedi
helper function to check if the range is unipolar.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/cb_pcidas.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index f5db76c50f5e..5757dacec094 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -171,8 +171,6 @@ static inline unsigned int DAC_CHAN_EN(unsigned int channel) #define PCIDAS_AO_FIFO_REG 0x00 #define PCIDAS_AO_FIFO_CLR_REG 0x02 -#define IS_UNIPOLAR 0x4 /* unipolar range mask */ - /* analog input ranges for most boards */ static const struct comedi_lrange cb_pcidas_ranges = { 8, { @@ -371,7 +369,7 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, /* set mux limits and gain */ bits = BEGIN_SCAN(chan) | END_SCAN(chan) | GAIN_BITS(range); /* set unipolar/bipolar */ - if (range & IS_UNIPOLAR) + if (comedi_range_is_unipolar(s, range)) bits |= UNIP; /* set single-ended/differential */ if (aref != AREF_DIFF) @@ -857,6 +855,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct cb_pcidas_private *devpriv = dev->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; + unsigned int range0 = CR_RANGE(cmd->chanlist[0]); unsigned int bits; unsigned long flags; @@ -870,9 +869,9 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, /* set mux limits, gain and pacer source */ bits = BEGIN_SCAN(CR_CHAN(cmd->chanlist[0])) | END_SCAN(CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])) | - GAIN_BITS(CR_RANGE(cmd->chanlist[0])); + GAIN_BITS(range0); /* set unipolar/bipolar */ - if (CR_RANGE(cmd->chanlist[0]) & IS_UNIPOLAR) + if (comedi_range_is_unipolar(s, range0)) bits |= UNIP; /* set singleended/differential */ if (CR_AREF(cmd->chanlist[0]) != AREF_DIFF) |