lkml.org 
[lkml]   [2015]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/32] staging: comedi: das08: improve test for programmable gain
Date
`das08_ai_rinsn()` handles Comedi `INSN_READ` instructions for the AI
subdevice. This programs the gain for the analog input channel if the
board has support for that, and acquires data from the channel. If
programmable gain is supported, the gain code is read from the array
pointed to by `devpriv->pg_gainlist` indexed by the range index. The
function assumes that programmable gain is supported if the AI
subdevice's range table supports more than one range. Replace that with
a more direct test for `devpriv->pg_gainlist` being non-NULL, as it is
only initialized to a non-NULL pointer for boards that support
programmable gain.

This will also allow range tables to be included for convenience for
those boards that support multiple ranges by DIP switches. Those boards
are currently initialized to use a single "unknown" range.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
drivers/staging/comedi/drivers/das08.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c
index b1cd6ea..2521352 100644
--- a/drivers/staging/comedi/drivers/das08.c
+++ b/drivers/staging/comedi/drivers/das08.c
@@ -225,7 +225,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL);
spin_unlock(&dev->spinlock);

- if (s->range_table->length > 1) {
+ if (devpriv->pg_gainlist) {
/* set gain/range */
range = CR_RANGE(insn->chanspec);
outb(devpriv->pg_gainlist[range],
--
2.1.4


\
 
 \ /
  Last update: 2015-06-05 20:01    [W:0.161 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site