From a81f87e9a08bae7a906a5cedae1ce100773c77df Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 9 Dec 2013 15:30:46 -0700 Subject: [PATCH] staging: comedi: pcmmio: remove 'iobase' from subdevice private data The 'iobase' is only used to pass the iobase address of the analog output registers to ao_winsn(). This address is simply dev->iobase + 8. Use that instead and remove the 'iobase' from the subdevice private data. This removes a couple more uses of the ugly 'subpriv' macro. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcmmio.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index f889e0f9c674..5726ded45f92 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -191,9 +191,6 @@ struct pcmmio_subdev_private { /* for DIO: mapping of halfwords (bytes) in port/chanarray to iobase */ unsigned long iobases[PORTS_PER_SUBDEV]; - - /* for AI/AO */ - unsigned long iobase; }; union { struct { @@ -887,8 +884,9 @@ 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; + unsigned long iobase = dev->iobase + 8; + unsigned int iooffset = 0; int n; - unsigned iobase = subpriv->iobase, iooffset = 0; for (n = 0; n < insn->n; n++) { unsigned chan = CR_CHAN(insn->chanspec), range = @@ -991,7 +989,6 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Next, AO */ s = &dev->subdevices[1]; - s->private = &devpriv->sprivs[1]; s->maxdata = 0xffff; s->range_table = &pcmmio_ao_ranges; s->subdev_flags = SDF_READABLE; @@ -1000,10 +997,10 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->len_chanlist = s->n_chan; s->insn_read = ao_rinsn; s->insn_write = ao_winsn; - subpriv->iobase = dev->iobase + 8; + /* initialize the resource enable register by clearing it */ - outb(0, subpriv->iobase + 3); - outb(0, subpriv->iobase + 4 + 3); + outb(0, dev->iobase + 8 + 3); + outb(0, dev->iobase + 8 + 4 + 3); port = 0; asic = 0; -- 2.30.2