summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-09-25 15:35:06 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 09:32:18 -0700
commit4916211615e21b1ae80632e57b6e0c8434b126fe (patch)
treef3f969bc297e64728c683206f54c3bc0cc6e29bc /drivers/staging/comedi/comedidev.h
parent5cb404d9272430e8a19c5d767885c63c6f1bfd17 (diff)
staging: comedi: core: introduce comedi_chan_range_is_{bi,uni}polar()
Introduce two helper functions to check if a subdevice range_table_list for a given channel/range is bipolar or 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>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index bec227665e6a..6db099bdbc58 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -307,6 +307,20 @@ static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s,
return s->range_table->range[range].min >= 0;
}
+static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s,
+ unsigned int chan,
+ unsigned int range)
+{
+ return s->range_table_list[chan]->range[range].min < 0;
+}
+
+static inline bool comedi_chan_range_is_unipolar(struct comedi_subdevice *s,
+ unsigned int chan,
+ unsigned int range)
+{
+ return s->range_table_list[chan]->range[range].min >= 0;
+}
+
/* munge between offset binary and two's complement values */
static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s,
unsigned int val)