aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-07-14 12:23:39 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-16 13:24:41 -0700
commita8b677cb534c78e0aaa3c999891df07073e25566 (patch)
tree6cf32b615144ac319a40a0b9d1182ca704e2548f /drivers/staging/comedi/comedidev.h
parentba9a1e3f07fc43df5f1b8bd8b0c72d0c3bbf5e16 (diff)
staging: comedi: comedidev.h: introduce some 'range_is_external' helpers
The comedi_krange includes a flags member that currently identifies the 'units' of the range (RF_UNIT) and if the range is from an internal or external source (RF_EXTERNAL). Introduce some helper functions to check if a given range is from an external source. 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>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 01679458ab63..a7f24a9f0a23 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -363,6 +363,12 @@ static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s,
return s->range_table->range[range].min >= 0;
}
+static inline bool comedi_range_is_external(struct comedi_subdevice *s,
+ unsigned int range)
+{
+ return !!(s->range_table->range[range].flags & RF_EXTERNAL);
+}
+
static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s,
unsigned int chan,
unsigned int range)
@@ -377,6 +383,13 @@ static inline bool comedi_chan_range_is_unipolar(struct comedi_subdevice *s,
return s->range_table_list[chan]->range[range].min >= 0;
}
+static inline bool comedi_chan_range_is_external(struct comedi_subdevice *s,
+ unsigned int chan,
+ unsigned int range)
+{
+ return !!(s->range_table_list[chan]->range[range].flags & RF_EXTERNAL);
+}
+
/* munge between offset binary and two's complement values */
static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s,
unsigned int val)