Staging: comedi: Remove comedi_driver typedef
[linux-2.6-block.git] / drivers / staging / comedi / drivers / rtd520.c
index 95e4af27bd8d7fa2e64f770b1a6e876476481f80..c238f5b97d854a5a2370a9ae9a318581819023b1 100644 (file)
@@ -266,7 +266,7 @@ static const comedi_lrange rtd_ao_range = { 4, {
 /*
   Board descriptions
  */
-typedef struct rtdBoard_struct {
+struct rtdBoard {
        const char *name;       /* must be first */
        int device_id;
        int aiChans;
@@ -274,9 +274,9 @@ typedef struct rtdBoard_struct {
        int aiMaxGain;
        int range10Start;       /* start of +-10V range */
        int rangeUniStart;      /* start of +10V range */
-} rtdBoard;
+};
 
-static const rtdBoard rtd520Boards[] = {
+static const struct rtdBoard rtd520Boards[] = {
        {
              name:     "DM7520",
              device_id : 0x7520,
@@ -308,13 +308,13 @@ MODULE_DEVICE_TABLE(pci, rtd520_pci_table);
 /*
  * Useful for shorthand access to the particular board structure
  */
-#define thisboard ((const rtdBoard *)dev->board_ptr)
+#define thisboard ((const struct rtdBoard *)dev->board_ptr)
 
 /*
    This structure is for data unique to this hardware driver.
    This is also unique for each board in the system.
 */
-typedef struct {
+struct rtdPrivate {
        /* memory mapped board structures */
        void *las0;
        void *las1;
@@ -334,7 +334,7 @@ typedef struct {
        unsigned char chanBipolar[RTD_MAX_CHANLIST / 8];        /* bit array */
 
        /* read back data */
-       lsampl_t aoValue[2];    /* Used for AO read back */
+       unsigned int aoValue[2];        /* Used for AO read back */
 
        /* timer gate (when enabled) */
        u8 utcGate[4];          /* 1 extra allows simple range check */
@@ -358,7 +358,7 @@ typedef struct {
        u8 dma1Control;
 #endif                         /* USE_DMA */
        unsigned fifoLen;
-} rtdPrivate;
+};
 
 /* bit defines for "flags" */
 #define SEND_EOS       0x01    /* send End Of Scan events */
@@ -377,7 +377,7 @@ typedef struct {
  * most drivers define the following macro to make it easy to
  * access the private structure.
  */
-#define devpriv ((rtdPrivate *)dev->private)
+#define devpriv ((struct rtdPrivate *)dev->private)
 
 /* Macros to access registers */
 
@@ -675,39 +675,39 @@ typedef struct {
     readb (devpriv->lcfg+LCFG_DMACSR1)
 
 /*
- * The comedi_driver structure tells the Comedi core module
+ * The struct comedi_driver structure tells the Comedi core module
  * which functions to call to configure/deconfigure (attac/detach)
  * the board, and also about the kernel module that contains
  * the device code.
  */
-static int rtd_attach(comedi_device *dev, comedi_devconfig *it);
-static int rtd_detach(comedi_device *dev);
+static int rtd_attach(struct comedi_device *dev, comedi_devconfig *it);
+static int rtd_detach(struct comedi_device *dev);
 
-static comedi_driver rtd520Driver = {
+static struct comedi_driver rtd520Driver = {
       driver_name: DRV_NAME,
       module : THIS_MODULE,
       attach : rtd_attach,
       detach : rtd_detach,
 };
 
-static int rtd_ai_rinsn(comedi_device *dev, comedi_subdevice *s,
-       comedi_insn *insn, lsampl_t *data);
-static int rtd_ao_winsn(comedi_device *dev, comedi_subdevice *s,
-       comedi_insn *insn, lsampl_t *data);
-static int rtd_ao_rinsn(comedi_device *dev, comedi_subdevice *s,
-       comedi_insn *insn, lsampl_t *data);
-static int rtd_dio_insn_bits(comedi_device *dev, comedi_subdevice *s,
-       comedi_insn *insn, lsampl_t *data);
-static int rtd_dio_insn_config(comedi_device *dev, comedi_subdevice *s,
-       comedi_insn *insn, lsampl_t *data);
-static int rtd_ai_cmdtest(comedi_device *dev, comedi_subdevice *s,
+static int rtd_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
+       comedi_insn *insn, unsigned int *data);
+static int rtd_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
+       comedi_insn *insn, unsigned int *data);
+static int rtd_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
+       comedi_insn *insn, unsigned int *data);
+static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
+       comedi_insn *insn, unsigned int *data);
+static int rtd_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
+       comedi_insn *insn, unsigned int *data);
+static int rtd_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
        comedi_cmd *cmd);
-static int rtd_ai_cmd(comedi_device *dev, comedi_subdevice *s);
-static int rtd_ai_cancel(comedi_device *dev, comedi_subdevice *s);
-/* static int rtd_ai_poll (comedi_device *dev,comedi_subdevice *s); */
+static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
+static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
+/* static int rtd_ai_poll (struct comedi_device *dev,struct comedi_subdevice *s); */
 static int rtd_ns_to_timer(unsigned int *ns, int roundMode);
 static irqreturn_t rtd_interrupt(int irq, void *d PT_REGS_ARG);
-static int rtd520_probe_fifo_depth(comedi_device *dev);
+static int rtd520_probe_fifo_depth(struct comedi_device *dev);
 
 /*
  * Attach is called by the Comedi core to configure the driver
@@ -715,9 +715,9 @@ static int rtd520_probe_fifo_depth(comedi_device *dev);
  * in the driver structure, dev->board_ptr contains that
  * address.
  */
-static int rtd_attach(comedi_device *dev, comedi_devconfig *it)
+static int rtd_attach(struct comedi_device *dev, comedi_devconfig *it)
 {                              /* board name and options flags */
-       comedi_subdevice *s;
+       struct comedi_subdevice *s;
        struct pci_dev *pcidev;
        int ret;
        resource_size_t physLas0;       /* configuation */
@@ -739,7 +739,7 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it)
         * Allocate the private structure area.  alloc_private() is a
         * convenient macro defined in comedidev.h.
         */
-       if (alloc_private(dev, sizeof(rtdPrivate)) < 0)
+       if (alloc_private(dev, sizeof(struct rtdPrivate)) < 0)
                return -ENOMEM;
 
        /*
@@ -1060,7 +1060,7 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it)
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  */
-static int rtd_detach(comedi_device *dev)
+static int rtd_detach(struct comedi_device *dev)
 {
 #ifdef USE_DMA
        int index;
@@ -1140,7 +1140,7 @@ static int rtd_detach(comedi_device *dev)
 /*
   Convert a single comedi channel-gain entry to a RTD520 table entry
 */
-static unsigned short rtdConvertChanGain(comedi_device *dev,
+static unsigned short rtdConvertChanGain(struct comedi_device *dev,
        unsigned int comediChan, int chanIndex)
 {                              /* index in channel list */
        unsigned int chan, range, aref;
@@ -1190,7 +1190,7 @@ static unsigned short rtdConvertChanGain(comedi_device *dev,
 /*
   Setup the channel-gain table from a comedi list
 */
-static void rtd_load_channelgain_list(comedi_device *dev,
+static void rtd_load_channelgain_list(struct comedi_device *dev,
        unsigned int n_chan, unsigned int *list)
 {
        if (n_chan > 1) {       /* setup channel gain table */
@@ -1209,9 +1209,9 @@ static void rtd_load_channelgain_list(comedi_device *dev,
 
 /* determine fifo size by doing adc conversions until the fifo half
 empty status flag clears */
-static int rtd520_probe_fifo_depth(comedi_device *dev)
+static int rtd520_probe_fifo_depth(struct comedi_device *dev)
 {
-       lsampl_t chanspec = CR_PACK(0, 0, AREF_GROUND);
+       unsigned int chanspec = CR_PACK(0, 0, AREF_GROUND);
        unsigned i;
        static const unsigned limit = 0x2000;
        unsigned fifo_size = 0;
@@ -1254,8 +1254,8 @@ static int rtd520_probe_fifo_depth(comedi_device *dev)
   Note, we don't do any settling delays.  Use a instruction list to
   select, delay, then read.
  */
-static int rtd_ai_rinsn(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int rtd_ai_rinsn(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_insn *insn, unsigned int *data)
 {
        int n, ii;
        int stat;
@@ -1307,12 +1307,12 @@ static int rtd_ai_rinsn(comedi_device *dev,
 
   The manual claims that we can do a lword read, but it doesn't work here.
 */
-static int ai_read_n(comedi_device *dev, comedi_subdevice *s, int count)
+static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s, int count)
 {
        int ii;
 
        for (ii = 0; ii < count; ii++) {
-               sampl_t sample;
+               short sample;
                s16 d;
 
                if (0 == devpriv->aiCount) {    /* done */
@@ -1346,10 +1346,10 @@ static int ai_read_n(comedi_device *dev, comedi_subdevice *s, int count)
 /*
   unknown amout of data is waiting in fifo.
 */
-static int ai_read_dregs(comedi_device *dev, comedi_subdevice *s)
+static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        while (RtdFifoStatus(dev) & FS_ADC_NOT_EMPTY) { /* 1 -> not empty */
-               sampl_t sample;
+               short sample;
                s16 d = RtdAdcFifoGet(dev);     /* get 2s comp value */
 
                if (0 == devpriv->aiCount) {    /* done */
@@ -1375,7 +1375,7 @@ static int ai_read_dregs(comedi_device *dev, comedi_subdevice *s)
 /*
   Terminate a DMA transfer and wait for everything to quiet down
 */
-void abort_dma(comedi_device *dev, unsigned int channel)
+void abort_dma(struct comedi_device *dev, unsigned int channel)
 {                              /* DMA channel 0, 1 */
        unsigned long dma_cs_addr;      /* the control/status register */
        uint8_t status;
@@ -1434,7 +1434,7 @@ void abort_dma(comedi_device *dev, unsigned int channel)
   Process what is in the DMA transfer buffer and pass to comedi
   Note: this is not re-entrant
 */
-static int ai_process_dma(comedi_device *dev, comedi_subdevice *s)
+static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        int ii, n;
        s16 *dp;
@@ -1444,7 +1444,7 @@ static int ai_process_dma(comedi_device *dev, comedi_subdevice *s)
 
        dp = devpriv->dma0Buff[devpriv->dma0Offset];
        for (ii = 0; ii < devpriv->fifoLen / 2;) {      /* convert samples */
-               sampl_t sample;
+               short sample;
 
                if (CHAN_ARRAY_TEST(devpriv->chanBipolar, s->async->cur_chan)) {
                        sample = (*dp >> 3) + 2048;     /* convert to comedi unsigned data */
@@ -1497,10 +1497,10 @@ static irqreturn_t rtd_interrupt(int irq,       /* interrupt number (ignored) */
        void *d                 /* our data */
        PT_REGS_ARG)
 {                              /* cpu context (ignored) */
-       comedi_device *dev = d; /* must be called "dev" for devpriv */
+       struct comedi_device *dev = d;  /* must be called "dev" for devpriv */
        u16 status;
        u16 fifoStatus;
-       comedi_subdevice *s = dev->subdevices + 0;      /* analog in subdevice */
+       struct comedi_subdevice *s = dev->subdevices + 0;       /* analog in subdevice */
 
        if (!dev->attached) {
                return IRQ_NONE;
@@ -1648,7 +1648,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */
 /*
   return the number of samples available
 */
-static int rtd_ai_poll(comedi_device *dev, comedi_subdevice *s)
+static int rtd_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        /* TODO: This needs to mask interrupts, read_dregs, and then re-enable */
        /* Not sure what to do if DMA is active */
@@ -1665,8 +1665,8 @@ static int rtd_ai_poll(comedi_device *dev, comedi_subdevice *s)
   the command passes.
 */
 
-static int rtd_ai_cmdtest(comedi_device *dev,
-       comedi_subdevice *s, comedi_cmd *cmd)
+static int rtd_ai_cmdtest(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_cmd *cmd)
 {
        int err = 0;
        int tmp;
@@ -1870,7 +1870,7 @@ static int rtd_ai_cmdtest(comedi_device *dev,
   This is usually done by an interrupt handler.
   Userland gets to the data using read calls.
 */
-static int rtd_ai_cmd(comedi_device *dev, comedi_subdevice *s)
+static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        comedi_cmd *cmd = &s->async->cmd;
        int timer;
@@ -2067,7 +2067,7 @@ static int rtd_ai_cmd(comedi_device *dev, comedi_subdevice *s)
 /*
   Stop a running data aquisition.
 */
-static int rtd_ai_cancel(comedi_device *dev, comedi_subdevice *s)
+static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        u16 status;
 
@@ -2135,8 +2135,8 @@ static int rtd_ns_to_timer(unsigned int *ns, int round_mode)
 /*
   Output one (or more) analog values to a single port as fast as possible.
 */
-static int rtd_ao_winsn(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int rtd_ao_winsn(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_insn *insn, unsigned int *data)
 {
        int i;
        int chan = CR_CHAN(insn->chanspec);
@@ -2190,8 +2190,8 @@ static int rtd_ao_winsn(comedi_device *dev,
 
 /* AO subdevices should have a read insn as well as a write insn.
  * Usually this means copying a value stored in devpriv. */
-static int rtd_ao_rinsn(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int rtd_ao_rinsn(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_insn *insn, unsigned int *data)
 {
        int i;
        int chan = CR_CHAN(insn->chanspec);
@@ -2213,8 +2213,8 @@ static int rtd_ao_rinsn(comedi_device *dev,
  * This allows packed reading/writing of the DIO channels.  The
  * comedi core can convert between insn_bits and insn_read/write
  */
-static int rtd_dio_insn_bits(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int rtd_dio_insn_bits(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_insn *insn, unsigned int *data)
 {
        if (insn->n != 2)
                return -EINVAL;
@@ -2240,8 +2240,8 @@ static int rtd_dio_insn_bits(comedi_device *dev,
 /*
   Configure one bit on a IO port as Input or Output (hence the name :-).
 */
-static int rtd_dio_insn_config(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int rtd_dio_insn_config(struct comedi_device *dev,
+       struct comedi_subdevice *s, comedi_insn *insn, unsigned int *data)
 {
        int chan = CR_CHAN(insn->chanspec);