staging: comedi: core: introduce comedi_chan_range_is_{bi,uni}polar()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 25 Sep 2013 22:35:06 +0000 (15:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Sep 2013 16:32:18 +0000 (09:32 -0700)
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>
drivers/staging/comedi/comedidev.h

index bec227665e6a1edebe8ab1ecd34fcf21660bf224..6db099bdbc580a8311b4b6d6b638b4ad14e8b443 100644 (file)
@@ -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)