Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8b677cb authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba9a1e3f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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)