summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/ni_mio_common.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2012-12-19 17:27:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-07 14:28:19 -0800
commit90a35c15c5d7d5c6254772d2752975dda185710c (patch)
tree7f240eb4dcd4d9f90e047a75515b7c8d50ca619d /drivers/staging/comedi/drivers/ni_mio_common.c
parent71cf6d3ee9351d668e9374d4026bf3337540eb22 (diff)
staging: comedi: store the 'index' for each subdevice
Store the 'index' for each comedi_subdevice when they are initially allocated by comedi_alloc_subdevice(). This allows removing the pointer math in comedi_fops.c which is used to figure out the index that user space uses to access the individual subdevices. Fix the ni_mio_common driver so it also uses the 'index' instead of doing the pointer math. Also, remove a couple unused macros in the pcmda12, pcmmio, and pcmuio drivers which also do the pointer math to figure out the index. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/ni_mio_common.c')
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 81d7350be84f..b7403597e905 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -986,7 +986,7 @@ static void ni_event(struct comedi_device *dev, struct comedi_subdevice *s)
if (s->
async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW |
COMEDI_CB_EOA)) {
- switch (s - dev->subdevices) {
+ switch (s->index) {
case NI_AI_SUBDEV:
ni_ai_reset(dev, s);
break;