[PATCH 04/13] staging: comedi: pcmuio: remove 'asic' from subdevice private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'asic' associated with a subdevice can be easily calculated. The
only functions that use this member in the subdevice private data can
only be called by the subdevices that support interrupts. Just
calculate the 'asic' and remove the member variable and the sanity
checks.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcmuio.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c
index e68c85d..39afd94 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -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
@@ -286,11 +284,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;
@@ -405,13 +399,9 @@ static int pcmuio_start_intr(struct comedi_device *dev,
 		return 1;
 	} else {
 		unsigned bits = 0, pol_bits = 0, n;
-		int asic;
+		int asic = s->index / 2;
 		struct comedi_cmd *cmd = &s->async->cmd;
 
-		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) {
@@ -651,7 +641,6 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		/* subdevices 0 and 2 suppport interrupts */
 		if ((sdev_no % 2) == 0 && dev->irq) {
 			/* setup the interrupt subdevice */
-			subpriv->intr.asic = sdev_no / 2;
 			dev->read_subdev = s;
 			s->subdev_flags |= SDF_CMD_READ;
 			s->cancel = pcmuio_cancel;
@@ -659,7 +648,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);
-- 
1.8.3.2

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




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux