The maximum differential channel is half the subdevice 'n_chan'. Use
that instead and remove the need for the 'board' variable.

Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
---
 drivers/staging/comedi/drivers/me4000.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c 
b/drivers/staging/comedi/drivers/me4000.c
index a1b30f9..2243e64 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -562,8 +562,6 @@ static int me4000_ai_check_chanlist(struct comedi_device 
*dev,
                                    struct comedi_subdevice *s,
                                    struct comedi_cmd *cmd)
 {
-       const struct me4000_board *board = dev->board_ptr;
-       unsigned int max_diff_chan = board->ai_diff_nchan;
        unsigned int aref0 = CR_AREF(cmd->chanlist[0]);
        int i;
 
@@ -579,7 +577,7 @@ static int me4000_ai_check_chanlist(struct comedi_device 
*dev,
                }
 
                if (aref == AREF_DIFF) {
-                       if (chan >= max_diff_chan) {
+                       if (chan >= (s->n_chan / 2)) {
                                dev_dbg(dev->class_dev,
                                        "Channel number to high\n");
                                return -EINVAL;
-- 
2.4.3

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to