summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-06-05 15:52:31 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 12:03:09 -0700
commite3693fd3baeddf2e96b2f7734a5fe5509acedb40 (patch)
treeec26941fc659bcd9232cfb47f9c71292321a92e1 /drivers/staging/comedi/comedidev.h
parent9a8e7f63dc77d2a4134791da74deb697889d56d9 (diff)
staging: comedi: introduce comedi_range_is_{bi,uni}polar()
Introduce some helper functions to check if a given 'range' index to a comedi_subdevice 'range_table' is a bipolar or unipolar range. 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>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index ab926a6654ef..57deabf77418 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -307,6 +307,18 @@ struct comedi_lrange {
struct comedi_krange range[GCC_ZERO_LENGTH_ARRAY];
};
+static inline bool comedi_range_is_bipolar(struct comedi_subdevice *s,
+ unsigned int range)
+{
+ return s->range_table->range[range].min < 0;
+}
+
+static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s,
+ unsigned int range)
+{
+ return s->range_table->range[range].min >= 0;
+}
+
/* some silly little inline functions */
static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd)