From: Ian Abbott Date: Mon, 9 Jan 2012 15:48:35 +0000 (+0000) Subject: staging: comedi: dt2801: do INSN_CONFIG properly for DIO subdevice. X-Git-Tag: MMI-PSA29.97-13-9~17268^2~176^2~51 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8383def69b8629df052f917acb844381bdd6e000;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: comedi: dt2801: do INSN_CONFIG properly for DIO subdevice. Handle INSN_CONFIG_DIO_INPUT, INSN_CONFIG_DIO_OUTPUT and INSN_CONFIG_DIO_QUERY in data[0]. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 5cce1b5f4484..b85c8366a396 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -720,12 +720,20 @@ static int dt2801_dio_insn_config(struct comedi_device *dev, which = 1; /* configure */ - if (data[0]) { + switch (data[0]) { + case INSN_CONFIG_DIO_OUTPUT: s->io_bits = 0xff; dt2801_writecmd(dev, DT_C_SET_DIGOUT); - } else { + break; + case INSN_CONFIG_DIO_INPUT: s->io_bits = 0; dt2801_writecmd(dev, DT_C_SET_DIGIN); + break; + case INSN_CONFIG_DIO_QUERY: + data[1] = s->io_bits ? COMEDI_OUTPUT : COMEDI_INPUT; + return insn->n; + default: + return -EINVAL; } dt2801_writedata(dev, which);