The main registers for this device are a port I/O region from PCI BAR 2 and that is the only device register region used by this driver. The driver has a `main_iobase` member in its private device data structure `struct adv_pci1724_private` to hold the base address of this I/O region, but as the `iobase` member of the `struct comedi_device` is going spare we can use that instead. Do so and get rid of the `main_iobase` member from the private device data. Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx> Cc: Frank Mori Hess <fmh6jj@xxxxxxxxx> --- drivers/staging/comedi/drivers/adv_pci1724.c | 29 ++++++++++------------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index e9796f2..b89637f 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(pci, adv_pci1724_pci_table); /* this structure is for data unique to this hardware driver. */ struct adv_pci1724_private { - resource_size_t main_iobase; unsigned board_id; /* 4 bit number settable via dip switches on board */ int ao_value[NUM_AO_CHANNELS]; int offset_value[NUM_AO_CHANNELS]; @@ -286,10 +285,8 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, if (retval) return retval; - priv(dev)->main_iobase = pci_resource_start(pcidev, 2); - - priv(dev)->board_id = inl(priv(dev)->main_iobase + BOARD_ID_REG) & - BOARD_ID_MASK; + dev->iobase = pci_resource_start(pcidev, 2); + priv(dev)->board_id = inl(dev->iobase + BOARD_ID_REG) & BOARD_ID_MASK; retval = setup_subdevices(dev); if (retval < 0) @@ -304,13 +301,9 @@ static void adv_pci1724_detach(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - if (priv(dev)) { - if (pcidev) { - if (priv(dev)->main_iobase) { - comedi_pci_disable(pcidev); - dev_info(dev->class_dev, "detached\n"); - } - } + if (pcidev && dev->iobase) { + comedi_pci_disable(pcidev); + dev_info(dev->class_dev, "detached\n"); } } @@ -320,10 +313,8 @@ static int wait_for_dac_idle(struct comedi_device *dev) int i; for (i = 0; i < timeout; ++i) { - if ((inl(priv(dev)->main_iobase + SYNC_OUTPUT_REG) & - DAC_BUSY) == 0) { + if ((inl(dev->iobase + SYNC_OUTPUT_REG) & DAC_BUSY) == 0) break; - } udelay(1); } if (i == timeout) { @@ -346,7 +337,7 @@ static int set_dac(struct comedi_device *dev, unsigned mode, unsigned channel, control_bits = mode; control_bits |= dac_channel_and_group_select_bits(channel); control_bits |= data & DAC_DATA_MASK; - outl(control_bits, priv(dev)->main_iobase + DAC_CONTROL_REG); + outl(control_bits, dev->iobase + DAC_CONTROL_REG); return 0; } @@ -358,7 +349,7 @@ static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, int i; /* turn off synchronous mode */ - outl(0, priv(dev)->main_iobase + SYNC_OUTPUT_REG); + outl(0, dev->iobase + SYNC_OUTPUT_REG); for (i = 0; i < insn->n; ++i) { retval = set_dac(dev, DAC_NORMAL_MODE, channel, data[i]); @@ -394,7 +385,7 @@ static int offset_write_insn(struct comedi_device *dev, int i; /* turn off synchronous mode */ - outl(0, priv(dev)->main_iobase + SYNC_OUTPUT_REG); + outl(0, dev->iobase + SYNC_OUTPUT_REG); for (i = 0; i < insn->n; ++i) { retval = set_dac(dev, DAC_OFFSET_MODE, channel, data[i]); @@ -431,7 +422,7 @@ static int gain_write_insn(struct comedi_device *dev, int i; /* turn off synchronous mode */ - outl(0, priv(dev)->main_iobase + SYNC_OUTPUT_REG); + outl(0, dev->iobase + SYNC_OUTPUT_REG); for (i = 0; i < insn->n; ++i) { retval = set_dac(dev, DAC_GAIN_MODE, channel, data[i]); -- 1.8.1.2 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel