]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: pcmuio: remove 'asic' member from subdevice private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 5 Dec 2013 23:54:06 +0000 (16:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Dec 2013 21:10:02 +0000 (13:10 -0800)
The 'asic' associated with a subdevice can be easily calculated. The
functions that use this member in the subdevice private data can only
be called by the subdevices that support interrupts. Just calculate
the 'asic' when needed and remove the member variable and sanity checks.

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>
drivers/staging/comedi/drivers/pcmuio.c

index 8752d4d09f3ff71c4c9f560792f66a04144e49ed..57a52dafac47d379a2e4b2ad90588cb76980c9e2 100644 (file)
@@ -130,8 +130,6 @@ static const struct pcmuio_board pcmuio_boards[] = {
 struct pcmuio_subdev_private {
        /* The below is only used for intr subdevices */
        struct {
-               /* if non-negative, this subdev has an interrupt asic */
-               int asic;
                /*
                 * subdev-relative channel mask for channels
                 * we are interested in
@@ -279,11 +277,7 @@ static void pcmuio_stop_intr(struct comedi_device *dev,
                             struct comedi_subdevice *s)
 {
        struct pcmuio_subdev_private *subpriv = s->private;
-       int asic;
-
-       asic = subpriv->intr.asic;
-       if (asic < 0)
-               return;         /* not an interrupt subdev */
+       int asic = s->index / 2;
 
        subpriv->intr.enabled_mask = 0;
        subpriv->intr.active = 0;
@@ -399,14 +393,10 @@ static int pcmuio_start_intr(struct comedi_device *dev,
                subpriv->intr.active = 0;
                return 1;
        } else {
-               unsigned bits = 0, pol_bits = 0, n;
-               int asic;
                struct comedi_cmd *cmd = &s->async->cmd;
+               int asic = s->index / 2;
+               unsigned bits = 0, pol_bits = 0, n;
 
-               asic = subpriv->intr.asic;
-               if (asic < 0)
-                       return 1;       /* not an interrupt
-                                          subdev */
                subpriv->intr.enabled_mask = 0;
                subpriv->intr.active = 1;
                if (cmd->chanlist) {
@@ -636,7 +626,6 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                if ((sdev_no == 0 && dev->irq) ||
                    (sdev_no == 2 && devpriv->irq2)) {
                        /* setup the interrupt subdevice */
-                       subpriv->intr.asic = sdev_no / 2;
                        dev->read_subdev = s;
                        s->subdev_flags |= SDF_CMD_READ;
                        s->cancel = pcmuio_cancel;
@@ -644,7 +633,6 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                        s->do_cmdtest = pcmuio_cmdtest;
                        s->len_chanlist = s->n_chan;
                } else {
-                       subpriv->intr.asic = -1;
                        s->len_chanlist = 1;
                }
                spin_lock_init(&subpriv->intr.spinlock);