From a29cd0eedf30779675d6a1a678da1ff55d681494 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 13 Nov 2012 13:43:44 -0700 Subject: [PATCH] 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: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1516.c | 20 +++++++++---------- .../staging/comedi/drivers/addi_apci_1516.c | 16 +++++++++------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c index 0658fe9b45ed..1aa0be3271dc 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -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; } diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c index 1423e1345c74..b56fa6ecb281 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1516.c +++ b/drivers/staging/comedi/drivers/addi_apci_1516.c @@ -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) -- 2.30.2