From 5c2ddb264f487eb4d6c06b9cd305d4d08d139e9d Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 16 May 2002 22:37:02 +0000 Subject: [PATCH] Change inttrig error handling. Fix spelling errors. --- comedi/comedi_fops.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 883e6801..033945f5 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -612,22 +612,33 @@ static int parse_insn(comedi_device *dev,comedi_insn *insn,lsampl_t *data,void * ret=1; break; case INSN_INTTRIG: + if(insn->n!=1){ + ret=-EINVAL; + break; + } if(insn->subdev>=dev->n_subdevices){ - DPRINTK("%d not useable subdevice\n",insn->subdev); + DPRINTK("%d not usable subdevice\n",insn->subdev); ret=-EINVAL; break; } s=dev->subdevices+insn->subdev; - if(!s->async || !s->async->inttrig){ - DPRINTK("no async or no inttrig\n"); + if(!s->async){ + DPRINTK("no async\n"); ret=-EINVAL; break; } - ret = s->async->inttrig(dev,s,0); + if(!s->async->inttrig){ + DPRINTK("no inttrig\n"); + ret=-EAGAIN; + break; + } + ret = s->async->inttrig(dev,s,insn->data[0]); + if(ret>=0)ret = 1; break; default: DPRINTK("invalid insn\n"); ret=-EINVAL; + break; } }else{ /* a subdevice instruction */ @@ -638,7 +649,7 @@ static int parse_insn(comedi_device *dev,comedi_insn *insn,lsampl_t *data,void * s=dev->subdevices+insn->subdev; if(s->type==COMEDI_SUBD_UNUSED){ - DPRINTK("%d not useable subdevice\n",insn->subdev); + DPRINTK("%d not usable subdevice\n",insn->subdev); ret = -EIO; goto out; } -- 2.26.2