Staging: comedi: Remove comedi_device typedef
[pandora-kernel.git] / drivers / staging / comedi / drivers / cb_pcidas64.c
index 4b1afce..4095381 100644 (file)
@@ -1044,12 +1044,12 @@ static DEFINE_PCI_DEVICE_TABLE(pcidas64_pci_table) = {
 
 MODULE_DEVICE_TABLE(pci, pcidas64_pci_table);
 
-static inline pcidas64_board *board(const comedi_device * dev)
+static inline pcidas64_board *board(const struct comedi_device * dev)
 {
        return (pcidas64_board *) dev->board_ptr;
 }
 
-static inline unsigned short se_diff_bit_6xxx(comedi_device * dev,
+static inline unsigned short se_diff_bit_6xxx(struct comedi_device * dev,
        int use_differential)
 {
        if ((board(dev)->layout == LAYOUT_64XX && !use_differential) ||
@@ -1114,7 +1114,7 @@ typedef struct {
 /* inline function that makes it easier to
  * access the private structure.
  */
-static inline pcidas64_private *priv(comedi_device * dev)
+static inline pcidas64_private *priv(struct comedi_device * dev)
 {
        return dev->private;
 }
@@ -1125,8 +1125,8 @@ static inline pcidas64_private *priv(comedi_device * dev)
  * the board, and also about the kernel module that contains
  * the device code.
  */
-static int attach(comedi_device * dev, comedi_devconfig * it);
-static int detach(comedi_device * dev);
+static int attach(struct comedi_device * dev, comedi_devconfig * it);
+static int detach(struct comedi_device * dev);
 static comedi_driver driver_cb_pcidas = {
       driver_name:"cb_pcidas64",
       module:THIS_MODULE,
@@ -1134,73 +1134,73 @@ static comedi_driver driver_cb_pcidas = {
       detach:detach,
 };
 
-static int ai_rinsn(comedi_device * dev, comedi_subdevice * s,
+static int ai_rinsn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int ai_config_insn(comedi_device * dev, comedi_subdevice * s,
+static int ai_config_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int ao_winsn(comedi_device * dev, comedi_subdevice * s,
+static int ao_winsn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int ao_readback_insn(comedi_device * dev, comedi_subdevice * s,
+static int ao_readback_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int ai_cmd(comedi_device * dev, comedi_subdevice * s);
-static int ai_cmdtest(comedi_device * dev, comedi_subdevice * s,
+static int ai_cmd(struct comedi_device * dev, comedi_subdevice * s);
+static int ai_cmdtest(struct comedi_device * dev, comedi_subdevice * s,
        comedi_cmd * cmd);
-static int ao_cmd(comedi_device * dev, comedi_subdevice * s);
-static int ao_inttrig(comedi_device * dev, comedi_subdevice * subdev,
+static int ao_cmd(struct comedi_device * dev, comedi_subdevice * s);
+static int ao_inttrig(struct comedi_device * dev, comedi_subdevice * subdev,
        unsigned int trig_num);
-static int ao_cmdtest(comedi_device * dev, comedi_subdevice * s,
+static int ao_cmdtest(struct comedi_device * dev, comedi_subdevice * s,
        comedi_cmd * cmd);
 static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG);
-static int ai_cancel(comedi_device * dev, comedi_subdevice * s);
-static int ao_cancel(comedi_device * dev, comedi_subdevice * s);
+static int ai_cancel(struct comedi_device * dev, comedi_subdevice * s);
+static int ao_cancel(struct comedi_device * dev, comedi_subdevice * s);
 static int dio_callback(int dir, int port, int data, unsigned long arg);
 static int dio_callback_4020(int dir, int port, int data, unsigned long arg);
-static int di_rbits(comedi_device * dev, comedi_subdevice * s,
+static int di_rbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int do_wbits(comedi_device * dev, comedi_subdevice * s,
+static int do_wbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int dio_60xx_config_insn(comedi_device * dev, comedi_subdevice * s,
+static int dio_60xx_config_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int dio_60xx_wbits(comedi_device * dev, comedi_subdevice * s,
+static int dio_60xx_wbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int calib_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int calib_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int calib_write_insn(comedi_device * dev, comedi_subdevice * s,
+static int calib_write_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int ad8402_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int ad8402_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static void ad8402_write(comedi_device * dev, unsigned int channel,
+static void ad8402_write(struct comedi_device * dev, unsigned int channel,
        unsigned int value);
-static int ad8402_write_insn(comedi_device * dev, comedi_subdevice * s,
+static int ad8402_write_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static int eeprom_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int eeprom_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data);
-static void check_adc_timing(comedi_device * dev, comedi_cmd * cmd);
+static void check_adc_timing(struct comedi_device * dev, comedi_cmd * cmd);
 static unsigned int get_divisor(unsigned int ns, unsigned int flags);
-static void i2c_write(comedi_device * dev, unsigned int address,
+static void i2c_write(struct comedi_device * dev, unsigned int address,
        const uint8_t * data, unsigned int length);
-static void caldac_write(comedi_device * dev, unsigned int channel,
+static void caldac_write(struct comedi_device * dev, unsigned int channel,
        unsigned int value);
-static int caldac_8800_write(comedi_device * dev, unsigned int address,
+static int caldac_8800_write(struct comedi_device * dev, unsigned int address,
        uint8_t value);
-//static int dac_1590_write(comedi_device *dev, unsigned int dac_a, unsigned int dac_b);
-static int caldac_i2c_write(comedi_device * dev, unsigned int caldac_channel,
+//static int dac_1590_write(struct comedi_device *dev, unsigned int dac_a, unsigned int dac_b);
+static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_channel,
        unsigned int value);
-static void abort_dma(comedi_device * dev, unsigned int channel);
-static void disable_plx_interrupts(comedi_device * dev);
-static int set_ai_fifo_size(comedi_device * dev, unsigned int num_samples);
-static unsigned int ai_fifo_size(comedi_device * dev);
-static int set_ai_fifo_segment_length(comedi_device * dev,
+static void abort_dma(struct comedi_device * dev, unsigned int channel);
+static void disable_plx_interrupts(struct comedi_device * dev);
+static int set_ai_fifo_size(struct comedi_device * dev, unsigned int num_samples);
+static unsigned int ai_fifo_size(struct comedi_device * dev);
+static int set_ai_fifo_segment_length(struct comedi_device * dev,
        unsigned int num_entries);
-static void disable_ai_pacing(comedi_device * dev);
-static void disable_ai_interrupts(comedi_device * dev);
-static void enable_ai_interrupts(comedi_device * dev, const comedi_cmd * cmd);
+static void disable_ai_pacing(struct comedi_device * dev);
+static void disable_ai_interrupts(struct comedi_device * dev);
+static void enable_ai_interrupts(struct comedi_device * dev, const comedi_cmd * cmd);
 static unsigned int get_ao_divisor(unsigned int ns, unsigned int flags);
-static void load_ao_dma(comedi_device * dev, const comedi_cmd * cmd);
+static void load_ao_dma(struct comedi_device * dev, const comedi_cmd * cmd);
 
 COMEDI_PCI_INITCLEANUP(driver_cb_pcidas, pcidas64_pci_table);
 
-static unsigned int ai_range_bits_6xxx(const comedi_device * dev,
+static unsigned int ai_range_bits_6xxx(const struct comedi_device * dev,
        unsigned int range_index)
 {
        const comedi_krange *range =
@@ -1244,7 +1244,7 @@ static unsigned int ai_range_bits_6xxx(const comedi_device * dev,
        return bits;
 }
 
-static unsigned int hw_revision(const comedi_device * dev,
+static unsigned int hw_revision(const struct comedi_device * dev,
        uint16_t hw_status_bits)
 {
        if (board(dev)->layout == LAYOUT_4020)
@@ -1253,7 +1253,7 @@ static unsigned int hw_revision(const comedi_device * dev,
        return (hw_status_bits >> 12) & 0xf;
 }
 
-static void set_dac_range_bits(comedi_device * dev, volatile uint16_t * bits,
+static void set_dac_range_bits(struct comedi_device * dev, volatile uint16_t * bits,
        unsigned int channel, unsigned int range)
 {
        unsigned int code = board(dev)->ao_range_code[range];
@@ -1273,7 +1273,7 @@ static inline int ao_cmd_is_supported(const pcidas64_board * board)
 }
 
 // initialize plx9080 chip
-static void init_plx9080(comedi_device * dev)
+static void init_plx9080(struct comedi_device * dev)
 {
        uint32_t bits;
        void *plx_iobase = priv(dev)->plx9080_iobase;
@@ -1363,7 +1363,7 @@ static void init_plx9080(comedi_device * dev)
 
 /* Allocate and initialize the subdevice structures.
  */
-static int setup_subdevices(comedi_device * dev)
+static int setup_subdevices(struct comedi_device * dev)
 {
        comedi_subdevice *s;
        void *dio_8255_iobase;
@@ -1526,14 +1526,14 @@ static int setup_subdevices(comedi_device * dev)
        return 0;
 }
 
-static void disable_plx_interrupts(comedi_device * dev)
+static void disable_plx_interrupts(struct comedi_device * dev)
 {
        priv(dev)->plx_intcsr_bits = 0;
        writel(priv(dev)->plx_intcsr_bits,
                priv(dev)->plx9080_iobase + PLX_INTRCS_REG);
 }
 
-static void init_stc_registers(comedi_device * dev)
+static void init_stc_registers(struct comedi_device * dev)
 {
        uint16_t bits;
        unsigned long flags;
@@ -1575,7 +1575,7 @@ static void init_stc_registers(comedi_device * dev)
        disable_ai_pacing(dev);
 };
 
-int alloc_and_init_dma_members(comedi_device * dev)
+int alloc_and_init_dma_members(struct comedi_device * dev)
 {
        int i;
 
@@ -1661,7 +1661,7 @@ int alloc_and_init_dma_members(comedi_device * dev)
        return 0;
 }
 
-static inline void warn_external_queue(comedi_device * dev)
+static inline void warn_external_queue(struct comedi_device * dev)
 {
        comedi_error(dev,
                "AO command and AI external channel queue cannot be used simultaneously.");
@@ -1673,7 +1673,7 @@ static inline void warn_external_queue(comedi_device * dev)
  * Attach is called by the Comedi core to configure the driver
  * for a particular board.
  */
-static int attach(comedi_device * dev, comedi_devconfig * it)
+static int attach(struct comedi_device * dev, comedi_devconfig * it)
 {
        struct pci_dev *pcidev;
        int index;
@@ -1821,7 +1821,7 @@ static int attach(comedi_device * dev, comedi_devconfig * it)
  * allocated by _attach().  dev->private and dev->subdevices are
  * deallocated automatically by the core.
  */
-static int detach(comedi_device * dev)
+static int detach(struct comedi_device * dev)
 {
        unsigned int i;
 
@@ -1881,7 +1881,7 @@ static int detach(comedi_device * dev)
        return 0;
 }
 
-static int ai_rinsn(comedi_device * dev, comedi_subdevice * s,
+static int ai_rinsn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        unsigned int bits = 0, n, i;
@@ -2018,7 +2018,7 @@ static int ai_rinsn(comedi_device * dev, comedi_subdevice * s,
        return n;
 }
 
-static int ai_config_calibration_source(comedi_device * dev, unsigned int * data)
+static int ai_config_calibration_source(struct comedi_device * dev, unsigned int * data)
 {
        unsigned int source = data[1];
        int num_calibration_sources;
@@ -2038,7 +2038,7 @@ static int ai_config_calibration_source(comedi_device * dev, unsigned int * data
        return 2;
 }
 
-static int ai_config_block_size(comedi_device * dev, unsigned int * data)
+static int ai_config_block_size(struct comedi_device * dev, unsigned int * data)
 {
        int fifo_size;
        const hw_fifo_info_t *const fifo = board(dev)->ai_fifo;
@@ -2065,7 +2065,7 @@ static int ai_config_block_size(comedi_device * dev, unsigned int * data)
        return 2;
 }
 
-static int ai_config_master_clock_4020(comedi_device * dev, unsigned int * data)
+static int ai_config_master_clock_4020(struct comedi_device * dev, unsigned int * data)
 {
        unsigned int divisor = data[4];
        int retval = 0;
@@ -2091,7 +2091,7 @@ static int ai_config_master_clock_4020(comedi_device * dev, unsigned int * data)
 }
 
 // XXX could add support for 60xx series
-static int ai_config_master_clock(comedi_device * dev, unsigned int * data)
+static int ai_config_master_clock(struct comedi_device * dev, unsigned int * data)
 {
 
        switch (board(dev)->layout) {
@@ -2106,7 +2106,7 @@ static int ai_config_master_clock(comedi_device * dev, unsigned int * data)
        return -EINVAL;
 }
 
-static int ai_config_insn(comedi_device * dev, comedi_subdevice * s,
+static int ai_config_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        int id = data[0];
@@ -2128,7 +2128,7 @@ static int ai_config_insn(comedi_device * dev, comedi_subdevice * s,
        return -EINVAL;
 }
 
-static int ai_cmdtest(comedi_device * dev, comedi_subdevice * s,
+static int ai_cmdtest(struct comedi_device * dev, comedi_subdevice * s,
        comedi_cmd * cmd)
 {
        int err = 0;
@@ -2324,7 +2324,7 @@ static int use_hw_sample_counter(comedi_cmd * cmd)
                return 0;
 }
 
-static void setup_sample_counters(comedi_device * dev, comedi_cmd * cmd)
+static void setup_sample_counters(struct comedi_device * dev, comedi_cmd * cmd)
 {
        if (cmd->stop_src == TRIG_COUNT) {
                // set software count
@@ -2341,7 +2341,7 @@ static void setup_sample_counters(comedi_device * dev, comedi_cmd * cmd)
        }
 }
 
-static inline unsigned int dma_transfer_size(comedi_device * dev)
+static inline unsigned int dma_transfer_size(struct comedi_device * dev)
 {
        unsigned int num_samples;
 
@@ -2354,7 +2354,7 @@ static inline unsigned int dma_transfer_size(comedi_device * dev)
        return num_samples;
 }
 
-static void disable_ai_pacing(comedi_device * dev)
+static void disable_ai_pacing(struct comedi_device * dev)
 {
        unsigned long flags;
 
@@ -2371,7 +2371,7 @@ static void disable_ai_pacing(comedi_device * dev)
                priv(dev)->main_iobase + ADC_CONTROL0_REG);
 }
 
-static void disable_ai_interrupts(comedi_device * dev)
+static void disable_ai_interrupts(struct comedi_device * dev)
 {
        unsigned long flags;
 
@@ -2387,7 +2387,7 @@ static void disable_ai_interrupts(comedi_device * dev)
        DEBUG_PRINT("intr enable bits 0x%x\n", priv(dev)->intr_enable_bits);
 }
 
-static void enable_ai_interrupts(comedi_device * dev, const comedi_cmd * cmd)
+static void enable_ai_interrupts(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        uint32_t bits;
        unsigned long flags;
@@ -2408,14 +2408,14 @@ static void enable_ai_interrupts(comedi_device * dev, const comedi_cmd * cmd)
        comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
-static uint32_t ai_convert_counter_6xxx(const comedi_device * dev,
+static uint32_t ai_convert_counter_6xxx(const struct comedi_device * dev,
        const comedi_cmd * cmd)
 {
        // supposed to load counter with desired divisor minus 3
        return cmd->convert_arg / TIMER_BASE - 3;
 }
 
-static uint32_t ai_scan_counter_6xxx(comedi_device * dev, comedi_cmd * cmd)
+static uint32_t ai_scan_counter_6xxx(struct comedi_device * dev, comedi_cmd * cmd)
 {
        uint32_t count;
        // figure out how long we need to delay at end of scan
@@ -2435,7 +2435,7 @@ static uint32_t ai_scan_counter_6xxx(comedi_device * dev, comedi_cmd * cmd)
        return count - 3;
 }
 
-static uint32_t ai_convert_counter_4020(comedi_device * dev, comedi_cmd * cmd)
+static uint32_t ai_convert_counter_4020(struct comedi_device * dev, comedi_cmd * cmd)
 {
        unsigned int divisor;
 
@@ -2456,7 +2456,7 @@ static uint32_t ai_convert_counter_4020(comedi_device * dev, comedi_cmd * cmd)
        return divisor - 2;
 }
 
-static void select_master_clock_4020(comedi_device * dev,
+static void select_master_clock_4020(struct comedi_device * dev,
        const comedi_cmd * cmd)
 {
        // select internal/external master clock
@@ -2475,7 +2475,7 @@ static void select_master_clock_4020(comedi_device * dev,
                priv(dev)->main_iobase + HW_CONFIG_REG);
 }
 
-static void select_master_clock(comedi_device * dev, const comedi_cmd * cmd)
+static void select_master_clock(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        switch (board(dev)->layout) {
        case LAYOUT_4020:
@@ -2486,7 +2486,7 @@ static void select_master_clock(comedi_device * dev, const comedi_cmd * cmd)
        }
 }
 
-static inline void dma_start_sync(comedi_device * dev, unsigned int channel)
+static inline void dma_start_sync(struct comedi_device * dev, unsigned int channel)
 {
        unsigned long flags;
 
@@ -2503,7 +2503,7 @@ static inline void dma_start_sync(comedi_device * dev, unsigned int channel)
        comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
-static void set_ai_pacing(comedi_device * dev, comedi_cmd * cmd)
+static void set_ai_pacing(struct comedi_device * dev, comedi_cmd * cmd)
 {
        uint32_t convert_counter = 0, scan_counter = 0;
 
@@ -2550,7 +2550,7 @@ static int use_internal_queue_6xxx(const comedi_cmd * cmd)
        return 1;
 }
 
-static int setup_channel_queue(comedi_device * dev, const comedi_cmd * cmd)
+static int setup_channel_queue(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        unsigned short bits;
        int i;
@@ -2652,7 +2652,7 @@ static int setup_channel_queue(comedi_device * dev, const comedi_cmd * cmd)
        return 0;
 }
 
-static inline void load_first_dma_descriptor(comedi_device * dev,
+static inline void load_first_dma_descriptor(struct comedi_device * dev,
        unsigned int dma_channel, unsigned int descriptor_bits)
 {
        /* The transfer size, pci address, and local address registers
@@ -2679,7 +2679,7 @@ static inline void load_first_dma_descriptor(comedi_device * dev,
        }
 }
 
-static int ai_cmd(comedi_device * dev, comedi_subdevice * s)
+static int ai_cmd(struct comedi_device * dev, comedi_subdevice * s)
 {
        comedi_async *async = s->async;
        comedi_cmd *cmd = &async->cmd;
@@ -2797,7 +2797,7 @@ static int ai_cmd(comedi_device * dev, comedi_subdevice * s)
 }
 
 // read num_samples from 16 bit wide ai fifo
-static void pio_drain_ai_fifo_16(comedi_device * dev)
+static void pio_drain_ai_fifo_16(struct comedi_device * dev)
 {
        comedi_subdevice *s = dev->read_subdev;
        comedi_async *async = s->async;
@@ -2864,7 +2864,7 @@ static void pio_drain_ai_fifo_16(comedi_device * dev)
  * dma transfers (it only supports the use of pio for draining the last remaining
  * points from the fifo when a data aquisition operation has completed).
  */
-static void pio_drain_ai_fifo_32(comedi_device * dev)
+static void pio_drain_ai_fifo_32(struct comedi_device * dev)
 {
        comedi_subdevice *s = dev->read_subdev;
        comedi_async *async = s->async;
@@ -2898,7 +2898,7 @@ static void pio_drain_ai_fifo_32(comedi_device * dev)
 }
 
 // empty fifo
-static void pio_drain_ai_fifo(comedi_device * dev)
+static void pio_drain_ai_fifo(struct comedi_device * dev)
 {
        if (board(dev)->layout == LAYOUT_4020) {
                pio_drain_ai_fifo_32(dev);
@@ -2906,7 +2906,7 @@ static void pio_drain_ai_fifo(comedi_device * dev)
                pio_drain_ai_fifo_16(dev);
 }
 
-static void drain_dma_buffers(comedi_device * dev, unsigned int channel)
+static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel)
 {
        comedi_async *async = dev->read_subdev->async;
        uint32_t next_transfer_addr;
@@ -2952,7 +2952,7 @@ static void drain_dma_buffers(comedi_device * dev, unsigned int channel)
         * unused buffer) */
 }
 
-void handle_ai_interrupt(comedi_device * dev, unsigned short status,
+void handle_ai_interrupt(struct comedi_device * dev, unsigned short status,
        unsigned int plx_status)
 {
        comedi_subdevice *s = dev->read_subdev;
@@ -3006,7 +3006,7 @@ void handle_ai_interrupt(comedi_device * dev, unsigned short status,
        cfc_handle_events(dev, s);
 }
 
-static inline unsigned int prev_ao_dma_index(comedi_device * dev)
+static inline unsigned int prev_ao_dma_index(struct comedi_device * dev)
 {
        unsigned int buffer_index;
 
@@ -3017,7 +3017,7 @@ static inline unsigned int prev_ao_dma_index(comedi_device * dev)
        return buffer_index;
 }
 
-static int last_ao_dma_load_completed(comedi_device * dev)
+static int last_ao_dma_load_completed(struct comedi_device * dev)
 {
        unsigned int buffer_index;
        unsigned int transfer_address;
@@ -3036,7 +3036,7 @@ static int last_ao_dma_load_completed(comedi_device * dev)
        return 1;
 }
 
-static int ao_stopped_by_error(comedi_device * dev, const comedi_cmd * cmd)
+static int ao_stopped_by_error(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        if (cmd->stop_src == TRIG_NONE)
                return 1;
@@ -3049,7 +3049,7 @@ static int ao_stopped_by_error(comedi_device * dev, const comedi_cmd * cmd)
        return 0;
 }
 
-static inline int ao_dma_needs_restart(comedi_device * dev,
+static inline int ao_dma_needs_restart(struct comedi_device * dev,
        unsigned short dma_status)
 {
        if ((dma_status & PLX_DMA_DONE_BIT) == 0 ||
@@ -3061,7 +3061,7 @@ static inline int ao_dma_needs_restart(comedi_device * dev,
        return 1;
 }
 
-static void restart_ao_dma(comedi_device * dev)
+static void restart_ao_dma(struct comedi_device * dev)
 {
        unsigned int dma_desc_bits;
 
@@ -3074,7 +3074,7 @@ static void restart_ao_dma(comedi_device * dev)
        dma_start_sync(dev, 0);
 }
 
-static void handle_ao_interrupt(comedi_device * dev, unsigned short status,
+static void handle_ao_interrupt(struct comedi_device * dev, unsigned short status,
        unsigned int plx_status)
 {
        comedi_subdevice *s = dev->write_subdev;
@@ -3128,7 +3128,7 @@ static void handle_ao_interrupt(comedi_device * dev, unsigned short status,
 
 static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG)
 {
-       comedi_device *dev = d;
+       struct comedi_device *dev = d;
        unsigned short status;
        uint32_t plx_status;
        uint32_t plx_bits;
@@ -3162,7 +3162,7 @@ static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG)
        return IRQ_HANDLED;
 }
 
-void abort_dma(comedi_device * dev, unsigned int channel)
+void abort_dma(struct comedi_device * dev, unsigned int channel)
 {
        unsigned long flags;
 
@@ -3174,7 +3174,7 @@ void abort_dma(comedi_device * dev, unsigned int channel)
        comedi_spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
-static int ai_cancel(comedi_device * dev, comedi_subdevice * s)
+static int ai_cancel(struct comedi_device * dev, comedi_subdevice * s)
 {
        unsigned long flags;
 
@@ -3194,7 +3194,7 @@ static int ai_cancel(comedi_device * dev, comedi_subdevice * s)
        return 0;
 }
 
-static int ao_winsn(comedi_device * dev, comedi_subdevice * s,
+static int ao_winsn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        int chan = CR_CHAN(insn->chanspec);
@@ -3224,7 +3224,7 @@ static int ao_winsn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static int ao_readback_insn(comedi_device * dev, comedi_subdevice * s,
+static int ao_readback_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        data[0] = priv(dev)->ao_value[CR_CHAN(insn->chanspec)];
@@ -3232,7 +3232,7 @@ static int ao_readback_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static void set_dac_control0_reg(comedi_device * dev, const comedi_cmd * cmd)
+static void set_dac_control0_reg(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        unsigned int bits = DAC_ENABLE_BIT | WAVEFORM_GATE_LEVEL_BIT |
                WAVEFORM_GATE_ENABLE_BIT | WAVEFORM_GATE_SELECT_BIT;
@@ -3252,7 +3252,7 @@ static void set_dac_control0_reg(comedi_device * dev, const comedi_cmd * cmd)
        writew(bits, priv(dev)->main_iobase + DAC_CONTROL0_REG);
 }
 
-static void set_dac_control1_reg(comedi_device * dev, const comedi_cmd * cmd)
+static void set_dac_control1_reg(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        int i;
 
@@ -3269,7 +3269,7 @@ static void set_dac_control1_reg(comedi_device * dev, const comedi_cmd * cmd)
                priv(dev)->main_iobase + DAC_CONTROL1_REG);
 }
 
-static void set_dac_select_reg(comedi_device * dev, const comedi_cmd * cmd)
+static void set_dac_select_reg(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        uint16_t bits;
        unsigned int first_channel, last_channel;
@@ -3284,7 +3284,7 @@ static void set_dac_select_reg(comedi_device * dev, const comedi_cmd * cmd)
        writew(bits, priv(dev)->main_iobase + DAC_SELECT_REG);
 }
 
-static void set_dac_interval_regs(comedi_device * dev, const comedi_cmd * cmd)
+static void set_dac_interval_regs(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        unsigned int divisor;
 
@@ -3302,7 +3302,7 @@ static void set_dac_interval_regs(comedi_device * dev, const comedi_cmd * cmd)
                priv(dev)->main_iobase + DAC_SAMPLE_INTERVAL_UPPER_REG);
 }
 
-static unsigned int load_ao_dma_buffer(comedi_device * dev,
+static unsigned int load_ao_dma_buffer(struct comedi_device * dev,
        const comedi_cmd * cmd)
 {
        unsigned int num_bytes, buffer_index, prev_buffer_index;
@@ -3346,7 +3346,7 @@ static unsigned int load_ao_dma_buffer(comedi_device * dev,
        return num_bytes;
 }
 
-static void load_ao_dma(comedi_device * dev, const comedi_cmd * cmd)
+static void load_ao_dma(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        unsigned int num_bytes;
        unsigned int next_transfer_addr;
@@ -3368,7 +3368,7 @@ static void load_ao_dma(comedi_device * dev, const comedi_cmd * cmd)
        } while (num_bytes >= DMA_BUFFER_SIZE);
 }
 
-static int prep_ao_dma(comedi_device * dev, const comedi_cmd * cmd)
+static int prep_ao_dma(struct comedi_device * dev, const comedi_cmd * cmd)
 {
        unsigned int num_bytes;
        int i;
@@ -3402,7 +3402,7 @@ static int prep_ao_dma(comedi_device * dev, const comedi_cmd * cmd)
        return 0;
 }
 
-static inline int external_ai_queue_in_use(comedi_device * dev)
+static inline int external_ai_queue_in_use(struct comedi_device * dev)
 {
        if (dev->read_subdev->busy)
                return 0;
@@ -3413,7 +3413,7 @@ static inline int external_ai_queue_in_use(comedi_device * dev)
        return 1;
 }
 
-static int ao_cmd(comedi_device * dev, comedi_subdevice * s)
+static int ao_cmd(struct comedi_device * dev, comedi_subdevice * s)
 {
        comedi_cmd *cmd = &s->async->cmd;
 
@@ -3438,7 +3438,7 @@ static int ao_cmd(comedi_device * dev, comedi_subdevice * s)
        return 0;
 }
 
-static int ao_inttrig(comedi_device * dev, comedi_subdevice * s,
+static int ao_inttrig(struct comedi_device * dev, comedi_subdevice * s,
        unsigned int trig_num)
 {
        comedi_cmd *cmd = &s->async->cmd;
@@ -3461,7 +3461,7 @@ static int ao_inttrig(comedi_device * dev, comedi_subdevice * s,
        return 0;
 }
 
-static int ao_cmdtest(comedi_device * dev, comedi_subdevice * s,
+static int ao_cmdtest(struct comedi_device * dev, comedi_subdevice * s,
        comedi_cmd * cmd)
 {
        int err = 0;
@@ -3577,7 +3577,7 @@ static int ao_cmdtest(comedi_device * dev, comedi_subdevice * s,
        return 0;
 }
 
-static int ao_cancel(comedi_device * dev, comedi_subdevice * s)
+static int ao_cancel(struct comedi_device * dev, comedi_subdevice * s)
 {
        writew(0x0, priv(dev)->main_iobase + DAC_CONTROL0_REG);
        abort_dma(dev, 0);
@@ -3605,7 +3605,7 @@ static int dio_callback_4020(int dir, int port, int data, unsigned long iobase)
        }
 }
 
-static int di_rbits(comedi_device * dev, comedi_subdevice * s,
+static int di_rbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        unsigned int bits;
@@ -3618,7 +3618,7 @@ static int di_rbits(comedi_device * dev, comedi_subdevice * s,
        return 2;
 }
 
-static int do_wbits(comedi_device * dev, comedi_subdevice * s,
+static int do_wbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        data[0] &= 0xf;
@@ -3634,7 +3634,7 @@ static int do_wbits(comedi_device * dev, comedi_subdevice * s,
        return 2;
 }
 
-static int dio_60xx_config_insn(comedi_device * dev, comedi_subdevice * s,
+static int dio_60xx_config_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        unsigned int mask;
@@ -3661,7 +3661,7 @@ static int dio_60xx_config_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static int dio_60xx_wbits(comedi_device * dev, comedi_subdevice * s,
+static int dio_60xx_wbits(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        if (data[0]) {
@@ -3676,7 +3676,7 @@ static int dio_60xx_wbits(comedi_device * dev, comedi_subdevice * s,
        return 2;
 }
 
-static void caldac_write(comedi_device * dev, unsigned int channel,
+static void caldac_write(struct comedi_device * dev, unsigned int channel,
        unsigned int value)
 {
        priv(dev)->caldac_state[channel] = value;
@@ -3694,7 +3694,7 @@ static void caldac_write(comedi_device * dev, unsigned int channel,
        }
 }
 
-static int calib_write_insn(comedi_device * dev, comedi_subdevice * s,
+static int calib_write_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        int channel = CR_CHAN(insn->chanspec);
@@ -3709,7 +3709,7 @@ static int calib_write_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static int calib_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int calib_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        unsigned int channel = CR_CHAN(insn->chanspec);
@@ -3719,7 +3719,7 @@ static int calib_read_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static void ad8402_write(comedi_device * dev, unsigned int channel,
+static void ad8402_write(struct comedi_device * dev, unsigned int channel,
        unsigned int value)
 {
        static const int bitstream_length = 10;
@@ -3750,7 +3750,7 @@ static void ad8402_write(comedi_device * dev, unsigned int channel,
 }
 
 /* for pci-das6402/16, channel 0 is analog input gain and channel 1 is offset */
-static int ad8402_write_insn(comedi_device * dev, comedi_subdevice * s,
+static int ad8402_write_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        int channel = CR_CHAN(insn->chanspec);
@@ -3767,7 +3767,7 @@ static int ad8402_write_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static int ad8402_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int ad8402_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        unsigned int channel = CR_CHAN(insn->chanspec);
@@ -3777,7 +3777,7 @@ static int ad8402_read_insn(comedi_device * dev, comedi_subdevice * s,
        return 1;
 }
 
-static uint16_t read_eeprom(comedi_device * dev, uint8_t address)
+static uint16_t read_eeprom(struct comedi_device * dev, uint8_t address)
 {
        static const int bitstream_length = 11;
        static const int read_command = 0x6;
@@ -3839,7 +3839,7 @@ static uint16_t read_eeprom(comedi_device * dev, uint8_t address)
        return value;
 }
 
-static int eeprom_read_insn(comedi_device * dev, comedi_subdevice * s,
+static int eeprom_read_insn(struct comedi_device * dev, comedi_subdevice * s,
        comedi_insn * insn, unsigned int * data)
 {
        data[0] = read_eeprom(dev, CR_CHAN(insn->chanspec));
@@ -3851,7 +3851,7 @@ static int eeprom_read_insn(comedi_device * dev, comedi_subdevice * s,
  * sets cmd members appropriately.
  * adc paces conversions from master clock by dividing by (x + 3) where x is 24 bit number
  */
-static void check_adc_timing(comedi_device * dev, comedi_cmd * cmd)
+static void check_adc_timing(struct comedi_device * dev, comedi_cmd * cmd)
 {
        unsigned int convert_divisor = 0, scan_divisor;
        static const int min_convert_divisor = 3;
@@ -3925,7 +3925,7 @@ static unsigned int get_ao_divisor(unsigned int ns, unsigned int flags)
 }
 
 // adjusts the size of hardware fifo (which determines block size for dma xfers)
-static int set_ai_fifo_size(comedi_device * dev, unsigned int num_samples)
+static int set_ai_fifo_size(struct comedi_device * dev, unsigned int num_samples)
 {
        unsigned int num_fifo_entries;
        int retval;
@@ -3946,14 +3946,14 @@ static int set_ai_fifo_size(comedi_device * dev, unsigned int num_samples)
 }
 
 // query length of fifo
-static unsigned int ai_fifo_size(comedi_device * dev)
+static unsigned int ai_fifo_size(struct comedi_device * dev)
 {
        return priv(dev)->ai_fifo_segment_length *
                board(dev)->ai_fifo->num_segments *
                board(dev)->ai_fifo->sample_packing_ratio;
 }
 
-static int set_ai_fifo_segment_length(comedi_device * dev,
+static int set_ai_fifo_segment_length(struct comedi_device * dev,
        unsigned int num_entries)
 {
        static const int increment_size = 0x100;
@@ -4004,7 +4004,7 @@ static int set_ai_fifo_segment_length(comedi_device * dev,
  * address 7 == dac channel 1 fine offset
 */
 
-static int caldac_8800_write(comedi_device * dev, unsigned int address,
+static int caldac_8800_write(struct comedi_device * dev, unsigned int address,
        uint8_t value)
 {
        static const int num_caldac_channels = 8;
@@ -4036,7 +4036,7 @@ static int caldac_8800_write(comedi_device * dev, unsigned int address,
 }
 
 // 4020 caldacs
-static int caldac_i2c_write(comedi_device * dev, unsigned int caldac_channel,
+static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_channel,
        unsigned int value)
 {
        uint8_t serial_bytes[3];
@@ -4101,7 +4101,7 @@ static const int i2c_high_comedi_udelay = 1000;
 static const int i2c_low_comedi_udelay = 10;
 
 // set i2c data line high or low
-static void i2c_set_sda(comedi_device * dev, int state)
+static void i2c_set_sda(struct comedi_device * dev, int state)
 {
        static const int data_bit = CTL_EE_W;
        void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG;
@@ -4120,7 +4120,7 @@ static void i2c_set_sda(comedi_device * dev, int state)
 }
 
 // set i2c clock line high or low
-static void i2c_set_scl(comedi_device * dev, int state)
+static void i2c_set_scl(struct comedi_device * dev, int state)
 {
        static const int clock_bit = CTL_USERO;
        void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG;
@@ -4138,7 +4138,7 @@ static void i2c_set_scl(comedi_device * dev, int state)
        }
 }
 
-static void i2c_write_byte(comedi_device * dev, uint8_t byte)
+static void i2c_write_byte(struct comedi_device * dev, uint8_t byte)
 {
        uint8_t bit;
        unsigned int num_bits = 8;
@@ -4156,7 +4156,7 @@ static void i2c_write_byte(comedi_device * dev, uint8_t byte)
 }
 
 // we can't really read the lines, so fake it
-static int i2c_read_ack(comedi_device * dev)
+static int i2c_read_ack(struct comedi_device * dev)
 {
        i2c_set_scl(dev, 0);
        i2c_set_sda(dev, 1);
@@ -4166,7 +4166,7 @@ static int i2c_read_ack(comedi_device * dev)
 }
 
 // send start bit
-static void i2c_start(comedi_device * dev)
+static void i2c_start(struct comedi_device * dev)
 {
        i2c_set_scl(dev, 1);
        i2c_set_sda(dev, 1);
@@ -4174,7 +4174,7 @@ static void i2c_start(comedi_device * dev)
 }
 
 // send stop bit
-static void i2c_stop(comedi_device * dev)
+static void i2c_stop(struct comedi_device * dev)
 {
        i2c_set_scl(dev, 0);
        i2c_set_sda(dev, 0);
@@ -4182,7 +4182,7 @@ static void i2c_stop(comedi_device * dev)
        i2c_set_sda(dev, 1);
 }
 
-static void i2c_write(comedi_device * dev, unsigned int address,
+static void i2c_write(struct comedi_device * dev, unsigned int address,
        const uint8_t * data, unsigned int length)
 {
        unsigned int i;