diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-03-07 20:41:05 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-17 19:38:54 (GMT) |
commit | ed8cd560206f0523e855d59f6bd341e5606ab5ca (patch) | |
tree | d485d2720496f7b2caa8878506ac9359c7a9f441 /drivers | |
parent | 7211806a7c8a1066aae7b0ddd200af7f071c3166 (diff) | |
download | linux-ed8cd560206f0523e855d59f6bd341e5606ab5ca.tar.xz |
staging: comedi: jr3_pci: remove 'n_channels' from private data
This member of the private data is actually the number of subdevices. We
can get that information directly from the comedi_device. Do that instead
and remove the unnecessary member from the private data.
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')
-rw-r--r-- | drivers/staging/comedi/drivers/jr3_pci.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 3e8f916..724a1f8 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -85,7 +85,6 @@ static const struct jr3_pci_board jr3_pci_boards[] = { struct jr3_pci_dev_private { struct jr3_t __iomem *iobase; - int n_channels; struct timer_list timer; }; @@ -302,13 +301,12 @@ static int jr3_pci_ai_insn_read(struct comedi_device *dev, static int jr3_pci_open(struct comedi_device *dev) { - struct jr3_pci_dev_private *devpriv = dev->private; struct jr3_pci_subdev_private *spriv; struct comedi_subdevice *s; int i; dev_dbg(dev->class_dev, "jr3_pci_open\n"); - for (i = 0; i < devpriv->n_channels; i++) { + for (i = 0; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; spriv = s->private; if (spriv) @@ -434,7 +432,6 @@ static int jr3_download_firmware(struct comedi_device *dev, const u8 *data, size_t size, unsigned long context) { - struct jr3_pci_dev_private *devpriv = dev->private; int subdev; int ret; @@ -444,7 +441,7 @@ static int jr3_download_firmware(struct comedi_device *dev, return ret; /* write firmware to each subdevice */ - for (subdev = 0; subdev < devpriv->n_channels; subdev++) + for (subdev = 0; subdev < dev->n_subdevices; subdev++) jr3_write_firmware(dev, subdev, data, size); return 0; @@ -608,7 +605,7 @@ static void jr3_pci_poll_dev(unsigned long data) now = jiffies; /* Poll all channels that are ready to be polled */ - for (i = 0; i < devpriv->n_channels; i++) { + for (i = 0; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; spriv = s->private; @@ -718,13 +715,12 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, if (!devpriv->iobase) return -ENOMEM; - devpriv->n_channels = board->n_subdevs; - ret = comedi_alloc_subdevices(dev, devpriv->n_channels); + ret = comedi_alloc_subdevices(dev, board->n_subdevs); if (ret) return ret; dev->open = jr3_pci_open; - for (i = 0; i < devpriv->n_channels; i++) { + for (i = 0; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; @@ -770,7 +766,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, } /* Start card timer */ - for (i = 0; i < devpriv->n_channels; i++) { + for (i = 0; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; spriv = s->private; |