Re: [PATCH 09/48] staging: comedi: pcmmio: move ai shadow data to device private data
On Tue, Dec 10, 2013 at 10:58:59AM +, Ian Abbott wrote: On 2013-12-09 22:30, H Hartley Sweeten wrote: There is only one ai subdevice in this driver so there is no reason to hold the last sample written to each channel in the subdevice private data. Move the data into the device private data, This gets some of the data out of the subdevice private data union and removes some of the uses of the ugly 'subpriv' macro. The patch title and description are wrong as this is the AO subdevice, but apart from that it's fine! I'll edit it... ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 09/48] staging: comedi: pcmmio: move ai shadow data to device private data
On 2013-12-09 22:30, H Hartley Sweeten wrote: There is only one ai subdevice in this driver so there is no reason to hold the last sample written to each channel in the subdevice private data. Move the data into the device private data, This gets some of the data out of the subdevice private data union and removes some of the uses of the ugly 'subpriv' macro. The patch title and description are wrong as this is the AO subdevice, but apart from that it's fine! Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcmmio.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 704911c..f889e0f 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -231,10 +231,6 @@ struct pcmmio_subdev_private { spinlock_t spinlock; } intr; } dio; - struct { - /* the last unsigned int data written */ - unsigned int shadow_samples[8]; - } ao; }; }; @@ -256,6 +252,7 @@ struct pcmmio_private { spinlock_t spinlock; } asics[MAX_ASICS]; struct pcmmio_subdev_private *sprivs; + unsigned int ao_readback[8]; }; #define subpriv ((struct pcmmio_subdev_private *)s-private) @@ -857,11 +854,13 @@ static int pcmmio_ai_insn_read(struct comedi_device *dev, static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pcmmio_private *devpriv = dev-private; int n; + for (n = 0; n insn-n; n++) { unsigned chan = CR_CHAN(insn-chanspec); if (chan s-n_chan) - data[n] = subpriv-ao.shadow_samples[chan]; + data[n] = devpriv-ao_readback[chan]; } return n; } @@ -887,6 +886,7 @@ static int wait_dac_ready(unsigned long iobase) static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pcmmio_private *devpriv = dev-private; int n; unsigned iobase = subpriv-iobase, iooffset = 0; @@ -925,7 +925,7 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, wait_dac_ready(iobase + iooffset); /* save to shadow register for ao_rinsn */ - subpriv-ao.shadow_samples[chan] = data[n]; + devpriv-ao_readback[chan] = data[n]; } } return n; -- -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/48] staging: comedi: pcmmio: move ai shadow data to device private data
There is only one ai subdevice in this driver so there is no reason to hold the last sample written to each channel in the subdevice private data. Move the data into the device private data, This gets some of the data out of the subdevice private data union and removes some of the uses of the ugly 'subpriv' macro. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcmmio.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 704911c..f889e0f 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -231,10 +231,6 @@ struct pcmmio_subdev_private { spinlock_t spinlock; } intr; } dio; - struct { - /* the last unsigned int data written */ - unsigned int shadow_samples[8]; - } ao; }; }; @@ -256,6 +252,7 @@ struct pcmmio_private { spinlock_t spinlock; } asics[MAX_ASICS]; struct pcmmio_subdev_private *sprivs; + unsigned int ao_readback[8]; }; #define subpriv ((struct pcmmio_subdev_private *)s-private) @@ -857,11 +854,13 @@ static int pcmmio_ai_insn_read(struct comedi_device *dev, static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pcmmio_private *devpriv = dev-private; int n; + for (n = 0; n insn-n; n++) { unsigned chan = CR_CHAN(insn-chanspec); if (chan s-n_chan) - data[n] = subpriv-ao.shadow_samples[chan]; + data[n] = devpriv-ao_readback[chan]; } return n; } @@ -887,6 +886,7 @@ static int wait_dac_ready(unsigned long iobase) static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct pcmmio_private *devpriv = dev-private; int n; unsigned iobase = subpriv-iobase, iooffset = 0; @@ -925,7 +925,7 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, wait_dac_ready(iobase + iooffset); /* save to shadow register for ao_rinsn */ - subpriv-ao.shadow_samples[chan] = data[n]; + devpriv-ao_readback[chan] = data[n]; } } return n; -- 1.8.4.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel