]> Pileus Git - ~andy/linux/commitdiff
staging: comedi: addi_apci_1516: remove use of struct addi_private
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 13 Nov 2012 20:43:44 +0000 (13:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2012 23:12:53 +0000 (15:12 -0800)
The only private data this driver has is the iobase address for the
watchdog. Create a local struct to hold this information in dev->private
and remove the need for struct addi_private from the "common" code.

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>
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
drivers/staging/comedi/drivers/addi_apci_1516.c

index 0658fe9b45edbc277b200e64c86e111a586accdc..1aa0be3271dc84054cd65eb17ef4640f6d72fbb9 100644 (file)
@@ -127,16 +127,16 @@ static int i_APCI1516_ConfigWatchdog(struct comedi_device *dev,
                                     struct comedi_insn *insn,
                                     unsigned int *data)
 {
-       struct addi_private *devpriv = dev->private;
+       struct apci1516_private *devpriv = dev->private;
 
        if (data[0] == 0) {
                /* Disable the watchdog */
-               outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+               outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
                /* Loading the Reload value */
-               outw(data[1], devpriv->i_IobaseAddon +
+               outw(data[1], devpriv->wdog_iobase +
                                APCI1516_WDOG_RELOAD_LSB_REG);
                data[1] = data[1] >> 16;
-               outw(data[1], devpriv->i_IobaseAddon +
+               outw(data[1], devpriv->wdog_iobase +
                                APCI1516_WDOG_RELOAD_MSB_REG);
        }                       /* if(data[0]==0) */
        else {
@@ -173,19 +173,19 @@ static int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev,
                                             struct comedi_insn *insn,
                                             unsigned int *data)
 {
-       struct addi_private *devpriv = dev->private;
+       struct apci1516_private *devpriv = dev->private;
 
        switch (data[0]) {
        case 0:         /* stop the watchdog */
-               outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+               outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
                break;
        case 1:         /* start the watchdog */
                outw(APCI1516_WDOG_CTRL_ENABLE,
-                    devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+                    devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
                break;
        case 2:         /* Software trigger */
                outw(APCI1516_WDOG_CTRL_ENABLE | APCI1516_WDOG_CTRL_SOFT_TRIG,
-                    devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+                    devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
                break;
        default:
                printk("\nSpecified functionality does not exist\n");
@@ -220,8 +220,8 @@ static int i_APCI1516_ReadWatchdog(struct comedi_device *dev,
                                   struct comedi_insn *insn,
                                   unsigned int *data)
 {
-       struct addi_private *devpriv = dev->private;
+       struct apci1516_private *devpriv = dev->private;
 
-       data[0] = inw(devpriv->i_IobaseAddon + APCI1516_WDOG_STATUS_REG) & 0x1;
+       data[0] = inw(devpriv->wdog_iobase + APCI1516_WDOG_STATUS_REG) & 0x1;
        return insn->n;
 }
index 1423e1345c74fa5a0639c9735760a14e647b291b..b56fa6ecb2811cf66eb1e46c4eda14e33438d520 100644 (file)
@@ -3,6 +3,10 @@
 
 #include "addi-data/addi_common.h"
 
+struct apci1516_private {
+       unsigned long wdog_iobase;
+};
+
 #include "addi-data/hwdrv_apci1516.c"
 
 static const struct addi_board apci1516_boardtypes[] = {
@@ -30,15 +34,15 @@ static const struct addi_board apci1516_boardtypes[] = {
 static int apci1516_reset(struct comedi_device *dev)
 {
        const struct addi_board *this_board = comedi_board(dev);
-       struct addi_private *devpriv = dev->private;
+       struct apci1516_private *devpriv = dev->private;
 
        if (!this_board->i_Timer)
                return 0;
 
        outw(0x0, dev->iobase + APCI1516_DO_REG);
-       outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
-       outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_RELOAD_LSB_REG);
-       outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_RELOAD_MSB_REG);
+       outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_CTRL_REG);
+       outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_RELOAD_LSB_REG);
+       outw(0x0, devpriv->wdog_iobase + APCI1516_WDOG_RELOAD_MSB_REG);
 
        return 0;
 }
@@ -65,7 +69,7 @@ static int __devinit apci1516_auto_attach(struct comedi_device *dev,
 {
        struct pci_dev *pcidev = comedi_to_pci_dev(dev);
        const struct addi_board *this_board;
-       struct addi_private *devpriv;
+       struct apci1516_private *devpriv;
        struct comedi_subdevice *s;
        int ret;
 
@@ -85,7 +89,7 @@ static int __devinit apci1516_auto_attach(struct comedi_device *dev,
                return ret;
 
        dev->iobase = pci_resource_start(pcidev, 1);
-       devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
+       devpriv->wdog_iobase = pci_resource_start(pcidev, 2);
 
        ret = comedi_alloc_subdevices(dev, 3);
        if (ret)