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

staging: comedi: addi_apci_3xxx: introduce a local private data definition

The struct addi_private definition from the addi-data "common" code is
very bloated. Introduce a local struct apci3xxx_private that just has
the data needed by this driver.

Add a couple includes that this driver depends on and remove the include
of "addi-data/addi_common.h" since this driver no longer depends on it.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e053b241
...@@ -73,7 +73,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY ...@@ -73,7 +73,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
*/ */
static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL) if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
return 1; return 1;
...@@ -115,7 +115,7 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -115,7 +115,7 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
const struct apci3xxx_boardinfo *this_board = comedi_board(dev); const struct apci3xxx_boardinfo *this_board = comedi_board(dev);
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_TimeBase = 0; unsigned char b_TimeBase = 0;
unsigned char b_SingleDiff = 0; unsigned char b_SingleDiff = 0;
...@@ -366,7 +366,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, ...@@ -366,7 +366,7 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
const struct apci3xxx_boardinfo *this_board = comedi_board(dev); const struct apci3xxx_boardinfo *this_board = comedi_board(dev);
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
...@@ -596,7 +596,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, ...@@ -596,7 +596,7 @@ static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
const struct apci3xxx_boardinfo *board = comedi_board(dev); const struct apci3xxx_boardinfo *board = comedi_board(dev);
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec);
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned int dw_Status = 0; unsigned int dw_Status = 0;
...@@ -701,7 +701,7 @@ static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, ...@@ -701,7 +701,7 @@ static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Command = 0; unsigned char b_Command = 0;
...@@ -831,7 +831,7 @@ static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, ...@@ -831,7 +831,7 @@ static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_ChannelCpt = 0; unsigned char b_ChannelCpt = 0;
unsigned int dw_ChannelMask = 0; unsigned int dw_ChannelMask = 0;
...@@ -988,7 +988,7 @@ static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, ...@@ -988,7 +988,7 @@ static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned int *pls_ReadData = data; unsigned int *pls_ReadData = data;
...@@ -1103,7 +1103,7 @@ static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, ...@@ -1103,7 +1103,7 @@ static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
int i_ReturnValue = insn->n; int i_ReturnValue = insn->n;
unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec);
unsigned char b_State = 0; unsigned char b_State = 0;
......
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#include "amcc_s5933.h" #include "amcc_s5933.h"
#include "addi-data/addi_common.h"
#ifndef COMEDI_SUBD_TTLIO #ifndef COMEDI_SUBD_TTLIO
#define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */ #define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */
#endif #endif
...@@ -384,12 +384,27 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = { ...@@ -384,12 +384,27 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
}, },
}; };
struct apci3xxx_private {
int iobase;
int i_IobaseReserved;
void __iomem *dw_AiBase;
unsigned char b_AiInitialisation;
unsigned int ui_AiNbrofChannels; /* how many channels is measured */
unsigned int ui_AiReadData[32];
unsigned char b_EocEosInterrupt;
unsigned int ui_EocEosConversionTime;
unsigned char b_EocEosConversionTimeBase;
unsigned char b_SingelDiff;
struct task_struct *tsk_Current;
unsigned int ul_TTLPortConfiguration[10];
};
#include "addi-data/hwdrv_apci3xxx.c" #include "addi-data/hwdrv_apci3xxx.c"
static irqreturn_t apci3xxx_irq_handler(int irq, void *d) static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
unsigned int status; unsigned int status;
int i; int i;
...@@ -424,7 +439,7 @@ static int apci3xxx_di_insn_bits(struct comedi_device *dev, ...@@ -424,7 +439,7 @@ static int apci3xxx_di_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
data[1] = inl(devpriv->iobase + 32) & 0xf; data[1] = inl(devpriv->iobase + 32) & 0xf;
...@@ -436,7 +451,7 @@ static int apci3xxx_do_insn_bits(struct comedi_device *dev, ...@@ -436,7 +451,7 @@ static int apci3xxx_do_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
unsigned int mask = data[0]; unsigned int mask = data[0];
unsigned int bits = data[1]; unsigned int bits = data[1];
...@@ -455,7 +470,7 @@ static int apci3xxx_do_insn_bits(struct comedi_device *dev, ...@@ -455,7 +470,7 @@ static int apci3xxx_do_insn_bits(struct comedi_device *dev,
static int apci3xxx_reset(struct comedi_device *dev) static int apci3xxx_reset(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
unsigned int val; unsigned int val;
int i; int i;
...@@ -490,7 +505,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -490,7 +505,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct apci3xxx_boardinfo *board = NULL; const struct apci3xxx_boardinfo *board = NULL;
struct addi_private *devpriv; struct apci3xxx_private *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret, n_subdevices; int ret, n_subdevices;
...@@ -629,7 +644,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -629,7 +644,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
static void apci3xxx_detach(struct comedi_device *dev) static void apci3xxx_detach(struct comedi_device *dev)
{ {
struct addi_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
if (devpriv) { if (devpriv) {
if (dev->iobase) 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