Commit a29cd0ee authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_1516: remove use of struct addi_private

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 005ce48e
......@@ -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;
}
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment