Commit 4c95a2b6 authored by Chase Southwood's avatar Chase Southwood Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_1564: introduce apci1564_private struct

The addi_private struct defined in addi-data/addi_common.h is very bloated
and contains many fields which addi_apci_1564 does not require.  In the
interest of eventually removing this driver's dependency on
addi_common.h, we can create a private data struct specifically for
addi_apci_1564 containing only the fields it will actually use.
Signed-off-by: default avatarChase Southwood <chase.southwood@gmail.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5f193d73
......@@ -6,6 +6,14 @@
#include "addi-data/addi_common.h"
struct apci1564_private {
unsigned int amcc_iobase; /* base of AMCC I/O registers */
unsigned int do_int_type;
unsigned char timer_select_mode;
unsigned char mode_select_register;
struct task_struct *tsk_current;
};
#include "addi-data/hwdrv_apci1564.c"
static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
......@@ -19,9 +27,9 @@ static int apci1564_di_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned int *data)
{
struct addi_private *devpriv = dev->private;
struct apci1564_private *devpriv = dev->private;
data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_DI_REG);
data[1] = inl(devpriv->amcc_iobase + APCI1564_DI_REG);
return insn->n;
}
......@@ -31,12 +39,12 @@ static int apci1564_do_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned int *data)
{
struct addi_private *devpriv = dev->private;
struct apci1564_private *devpriv = dev->private;
s->state = inl(devpriv->i_IobaseAmcc + APCI1564_DO_REG);
s->state = inl(devpriv->amcc_iobase + APCI1564_DO_REG);
if (comedi_dio_update_state(s, data))
outl(s->state, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
outl(s->state, devpriv->amcc_iobase + APCI1564_DO_REG);
data[1] = s->state;
......@@ -45,26 +53,26 @@ static int apci1564_do_insn_bits(struct comedi_device *dev,
static int apci1564_reset(struct comedi_device *dev)
{
struct addi_private *devpriv = dev->private;
struct apci1564_private *devpriv = dev->private;
ui_Type = 0;
devpriv->do_int_type = 0;
/* Disable the input interrupts and reset status register */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG);
inl(devpriv->i_IobaseAmcc + APCI1564_DI_INT_STATUS_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE1_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
inl(devpriv->amcc_iobase + APCI1564_DI_INT_STATUS_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_INT_MODE1_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_INT_MODE2_REG);
/* Reset the output channels and disable interrupts */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DO_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DO_INT_CTRL_REG);
/* Reset the watchdog registers */
addi_watchdog_reset(devpriv->i_IobaseAmcc + APCI1564_WDOG_REG);
addi_watchdog_reset(devpriv->amcc_iobase + APCI1564_WDOG_REG);
/* Reset the timer registers */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_CTRL_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_RELOAD_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_TIMER_RELOAD_REG);
/* Reset the counter registers */
outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
......@@ -79,7 +87,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct addi_private *devpriv;
struct apci1564_private *devpriv;
struct comedi_subdevice *s;
int ret;
......@@ -94,7 +102,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
return ret;
dev->iobase = pci_resource_start(pcidev, 1);
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
devpriv->amcc_iobase = pci_resource_start(pcidev, 0);
apci1564_reset(dev);
......@@ -149,7 +157,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
static void apci1564_detach(struct comedi_device *dev)
{
struct addi_private *devpriv = dev->private;
struct apci1564_private *devpriv = dev->private;
if (devpriv) {
if (dev->iobase)
......
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