On 2014-07-14 20:23, H Hartley Sweeten wrote:
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 <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
drivers/staging/comedi/comedidev.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/staging/comedi/comedidev.h
b/drivers/staging/comedi/comedidev.h
index 83fd155..6af6467 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)
Converting any value to _Bool (typedef'd to bool in <linux/types.h>)
automatically produces the value 0 or 1, so the "double logical NOT"
operators are redundant here. They're harmless though!
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbo...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel