diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-06-04 02:05:45 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-05 22:35:39 (GMT) |
commit | ef7654c056dbcf19fc560fad1b28ee611b487469 (patch) | |
tree | 9cf3e0c73fdeee8770df71a2c0b5a5a221681b63 | |
parent | 78b2db4fda5985c7da4526aa0505c1ed66c2e526 (diff) | |
download | linux-fsl-qoriq-ef7654c056dbcf19fc560fad1b28ee611b487469.tar.xz |
staging: comedi: pcmda12: tidy up zero_chans()
Rename the function so it has namespace associated with the driver.
For aesthetic reasons, move the function closer to it's only caller.
Pass the comedi_subdevice pointer to the function so we can get the
number of channels to reset from it instead of using the 'CHANS'
define.
Remove the 'CHANS' define since it's a very generic name.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/pcmda12.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 4e214e9..bc6cdd1 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -49,7 +49,6 @@ Configuration Options: #include "../comedidev.h" -#define CHANS 8 #define IOSIZE 16 /* AI range is not configurable, it's set by jumpers on the board */ @@ -62,24 +61,10 @@ static const struct comedi_lrange pcmda12_ranges = { }; struct pcmda12_private { - - unsigned int ao_readback[CHANS]; + unsigned int ao_readback[8]; int simultaneous_xfer_mode; }; -static void zero_chans(struct comedi_device *dev) -{ - int i; - - for (i = 0; i < CHANS; ++i) { - - outb(0, dev->iobase + (i * 2)); - outb(0, dev->iobase + (i * 2) + 1); - } - /* Initiate transfer by reading one of the AO registers. */ - inb(dev->iobase); -} - static int pcmda12_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -130,6 +115,19 @@ static int pcmda12_ao_insn_read(struct comedi_device *dev, return insn->n; } +static void pcmda12_ao_reset(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + int i; + + for (i = 0; i < s->n_chan; ++i) { + outb(0, dev->iobase + (i * 2)); + outb(0, dev->iobase + (i * 2) + 1); + } + /* Initiate transfer by reading one of the AO registers. */ + inb(dev->iobase); +} + static int pcmda12_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -155,13 +153,13 @@ static int pcmda12_attach(struct comedi_device *dev, s = &dev->subdevices[0]; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = CHANS; + s->n_chan = 8; s->maxdata = 0x0fff; s->range_table = &pcmda12_ranges; s->insn_write = pcmda12_ao_insn_write; s->insn_read = pcmda12_ao_insn_read; - zero_chans(dev); /* clear out all the registers, basically */ + pcmda12_ao_reset(dev, s); return 1; } |