Skip to content

Commit

Permalink
staging: comedi: adl_pci6208: fix the ao_readback variable size
Browse files Browse the repository at this point in the history
The 'ao_readback' variable in the private data struct is used to
cache the last value written to the analog output DAC channels.
The PCI-6208 has 8 analog output channels but the variable only
allowed space to cache 2 values.

Since the PCI-6216 board could be supported by this driver and
it has 16 analog outputs, create a define for the maximum number
of channels and use that to set the size of 'ao_readback'.

For now, set the max to 8 to save space since the PCI-6216 is
not currently supported.

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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 6, 2012
1 parent 149b98d commit 5c67df8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci6208.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Configuration Options:
#define PCI6208_DIO_DI_MASK (0xf0)
#define PCI6208_DIO_DI_SHIFT (4)

#define PCI6208_MAX_AO_CHANNELS 8

struct pci6208_board {
const char *name;
unsigned short dev_id;
Expand All @@ -72,7 +74,7 @@ static const struct pci6208_board pci6208_boards[] = {

struct pci6208_private {
struct pci_dev *pci_dev;
unsigned int ao_readback[2];
unsigned int ao_readback[PCI6208_MAX_AO_CHANNELS];
};

static int pci6208_ao_winsn(struct comedi_device *dev,
Expand Down

0 comments on commit 5c67df8

Please sign in to comment.