staging: comedi: rename addi CamelCase function pointers

Rename the CamelCase variable names for the ADDI subdevice
functions. This makes the code a bit cleaner and easier to
follow.

This will also help with converting the struct addi_board
boardtypes array to C99 style initialization to help with
maintaining the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2012-05-07 12:14:22 -07:00 committed by Greg Kroah-Hartman
parent 7806012e97
commit a19fb006c4
3 changed files with 89 additions and 137 deletions

View File

@ -2819,16 +2819,13 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* Set the initialisation flag */ /* Set the initialisation flag */
devpriv->b_AiInitialisation = 1; devpriv->b_AiInitialisation = 1;
s->insn_config = s->insn_config = this_board->ai_config;
this_board->i_hwdrv_InsnConfigAnalogInput; s->insn_read = this_board->ai_read;
s->insn_read = this_board->i_hwdrv_InsnReadAnalogInput; s->insn_write = this_board->ai_write;
s->insn_write = s->insn_bits = this_board->ai_bits;
this_board->i_hwdrv_InsnWriteAnalogInput; s->do_cmdtest = this_board->ai_cmdtest;
s->insn_bits = this_board->i_hwdrv_InsnBitsAnalogInput; s->do_cmd = this_board->ai_cmd;
s->do_cmdtest = s->cancel = this_board->ai_cancel;
this_board->i_hwdrv_CommandTestAnalogInput;
s->do_cmd = this_board->i_hwdrv_CommandAnalogInput;
s->cancel = this_board->i_hwdrv_CancelAnalogInput;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
@ -2844,10 +2841,8 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->len_chanlist = s->len_chanlist =
devpriv->s_EeParameters.i_NbrAoChannel; devpriv->s_EeParameters.i_NbrAoChannel;
s->range_table = this_board->pr_AoRangelist; s->range_table = this_board->pr_AoRangelist;
s->insn_config = s->insn_config = this_board->ao_config;
this_board->i_hwdrv_InsnConfigAnalogOutput; s->insn_write = this_board->ao_write;
s->insn_write =
this_board->i_hwdrv_InsnWriteAnalogOutput;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
@ -2862,12 +2857,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->s_EeParameters.i_NbrDiChannel; devpriv->s_EeParameters.i_NbrDiChannel;
s->range_table = &range_digital; s->range_table = &range_digital;
s->io_bits = 0; /* all bits input */ s->io_bits = 0; /* all bits input */
s->insn_config = s->insn_config = this_board->di_config;
this_board->i_hwdrv_InsnConfigDigitalInput; s->insn_read = this_board->di_read;
s->insn_read = this_board->i_hwdrv_InsnReadDigitalInput; s->insn_write = this_board->di_write;
s->insn_write = s->insn_bits = this_board->di_bits;
this_board->i_hwdrv_InsnWriteDigitalInput;
s->insn_bits = this_board->i_hwdrv_InsnBitsDigitalInput;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
@ -2884,13 +2877,11 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->range_table = &range_digital; s->range_table = &range_digital;
s->io_bits = 0xf; /* all bits output */ s->io_bits = 0xf; /* all bits output */
s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput; /* for digital output memory.. */ /* insn_config - for digital output memory */
s->insn_write = s->insn_config = this_board->do_config;
this_board->i_hwdrv_InsnWriteDigitalOutput; s->insn_write = this_board->do_write;
s->insn_bits = s->insn_bits = this_board->do_bits;
this_board->i_hwdrv_InsnBitsDigitalOutput; s->insn_read = this_board->do_read;
s->insn_read =
this_board->i_hwdrv_InsnReadDigitalOutput;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
@ -2905,10 +2896,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->len_chanlist = 1; s->len_chanlist = 1;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_write = this_board->i_hwdrv_InsnWriteTimer; s->insn_write = this_board->timer_write;
s->insn_read = this_board->i_hwdrv_InsnReadTimer; s->insn_read = this_board->timer_read;
s->insn_config = this_board->i_hwdrv_InsnConfigTimer; s->insn_config = this_board->timer_config;
s->insn_bits = this_board->i_hwdrv_InsnBitsTimer; s->insn_bits = this_board->timer_bits;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
@ -2924,10 +2915,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->io_bits = 0; /* all bits input */ s->io_bits = 0; /* all bits input */
s->len_chanlist = this_board->i_NbrTTLChannel; s->len_chanlist = this_board->i_NbrTTLChannel;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_config = this_board->i_hwdr_ConfigInitTTLIO; s->insn_config = this_board->ttl_config;
s->insn_bits = this_board->i_hwdr_ReadTTLIOBits; s->insn_bits = this_board->ttl_bits;
s->insn_read = this_board->i_hwdr_ReadTTLIOAllPortValue; s->insn_read = this_board->ttl_read;
s->insn_write = this_board->i_hwdr_WriteTTLIOChlOnOff; s->insn_write = this_board->ttl_write;
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
@ -3039,7 +3030,7 @@ static int i_ADDI_Detach(struct comedi_device *dev)
static int i_ADDI_Reset(struct comedi_device *dev) static int i_ADDI_Reset(struct comedi_device *dev)
{ {
this_board->i_hwdrv_Reset(dev); this_board->reset(dev);
return 0; return 0;
} }
@ -3065,7 +3056,7 @@ static int i_ADDI_Reset(struct comedi_device *dev)
static irqreturn_t v_ADDI_Interrupt(int irq, void *d) static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
this_board->v_hwdrv_Interrupt(irq, d); this_board->interrupt(irq, d);
return IRQ_RETVAL(1); return IRQ_RETVAL(1);
} }

View File

@ -94,111 +94,72 @@ struct addi_board {
unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */ unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */
/* interrupt and reset */ /* interrupt and reset */
void (*v_hwdrv_Interrupt)(int irq, void *d); void (*interrupt)(int irq, void *d);
int (*i_hwdrv_Reset)(struct comedi_device *dev); int (*reset)(struct comedi_device *);
/* Subdevice functions */ /* Subdevice functions */
/* ANALOG INPUT */ /* ANALOG INPUT */
int (*i_hwdrv_InsnConfigAnalogInput)(struct comedi_device *dev, int (*ai_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*ai_read)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnReadAnalogInput)(struct comedi_device *dev, int (*ai_write)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*ai_bits)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnWriteAnalogInput)(struct comedi_device *dev, int (*ai_cmdtest)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_cmd *);
struct comedi_insn *insn, int (*ai_cmd)(struct comedi_device *, struct comedi_subdevice *);
unsigned int *data); int (*ai_cancel)(struct comedi_device *, struct comedi_subdevice *);
int (*i_hwdrv_InsnBitsAnalogInput)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
int (*i_hwdrv_CommandTestAnalogInput)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd);
int (*i_hwdrv_CommandAnalogInput)(struct comedi_device *dev,
struct comedi_subdevice *s);
int (*i_hwdrv_CancelAnalogInput)(struct comedi_device *dev,
struct comedi_subdevice *s);
/* Analog Output */ /* Analog Output */
int (*i_hwdrv_InsnConfigAnalogOutput)(struct comedi_device *dev, int (*ao_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*ao_write)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnWriteAnalogOutput)(struct comedi_device *dev, int (*ao_bits)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn,
unsigned int *data);
int (*i_hwdrv_InsnBitsAnalogOutput)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
/* Digital Input */ /* Digital Input */
int (*i_hwdrv_InsnConfigDigitalInput) (struct comedi_device *dev, int (*di_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*di_read)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnReadDigitalInput) (struct comedi_device *dev, int (*di_write)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*di_bits)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnWriteDigitalInput) (struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
int (*i_hwdrv_InsnBitsDigitalInput) (struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
/* Digital Output */ /* Digital Output */
int (*i_hwdrv_InsnConfigDigitalOutput)(struct comedi_device *dev, int (*do_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*do_write)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnWriteDigitalOutput)(struct comedi_device *dev, int (*do_bits)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, int (*do_read)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnBitsDigitalOutput)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
int (*i_hwdrv_InsnReadDigitalOutput)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
/* TIMER */ /* TIMER */
int (*i_hwdrv_InsnConfigTimer)(struct comedi_device *dev, int (*timer_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, unsigned int *data); int (*timer_write)(struct comedi_device *, struct comedi_subdevice *,
int (*i_hwdrv_InsnWriteTimer)(struct comedi_device *dev, struct comedi_insn *, unsigned int *);
struct comedi_subdevice *s, struct comedi_insn *insn, int (*timer_read)(struct comedi_device *, struct comedi_subdevice *,
unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnReadTimer)(struct comedi_device *dev, struct comedi_subdevice *s, int (*timer_bits)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_insn *insn, unsigned int *data); struct comedi_insn *, unsigned int *);
int (*i_hwdrv_InsnBitsTimer)(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
/* TTL IO */ /* TTL IO */
int (*i_hwdr_ConfigInitTTLIO)(struct comedi_device *dev, int (*ttl_config)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_subdevice *s, struct comedi_insn *insn, struct comedi_insn *, unsigned int *);
unsigned int *data); int (*ttl_bits)(struct comedi_device *, struct comedi_subdevice *,
int (*i_hwdr_ReadTTLIOBits)(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *, unsigned int *);
struct comedi_insn *insn, unsigned int *data); int (*ttl_read)(struct comedi_device *, struct comedi_subdevice *,
int (*i_hwdr_ReadTTLIOAllPortValue)(struct comedi_device *dev, struct comedi_insn *, unsigned int *);
struct comedi_subdevice *s, int (*ttl_write)(struct comedi_device *, struct comedi_subdevice *,
struct comedi_insn *insn, struct comedi_insn *, unsigned int *);
unsigned int *data);
int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
}; };
/* MODULE INFO STRUCTURE */ /* MODULE INFO STRUCTURE */

View File

@ -156,7 +156,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
} else } else
us_ConvertTiming = (unsigned short) (devpriv->ui_EocEosConversionTime / 1000); /* nano to useconds */ us_ConvertTiming = (unsigned short) (devpriv->ui_EocEosConversionTime / 1000); /* nano to useconds */
/* this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); */ /* this_board->ai_read(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); */
/* Clear software registers */ /* Clear software registers */
devpriv->b_TimerSelectMode = 0; devpriv->b_TimerSelectMode = 0;
@ -670,7 +670,7 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde
/* mode 1 */ /* mode 1 */
devpriv->ui_AiTimer0 = cmd->convert_arg; /* timer constant in nano seconds */ devpriv->ui_AiTimer0 = cmd->convert_arg; /* timer constant in nano seconds */
/* return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); */ /* return this_board->ai_cmd(1,dev,s); */
return i_APCI3120_CyclicAnalogInput(1, dev, s); return i_APCI3120_CyclicAnalogInput(1, dev, s);
} }
@ -680,7 +680,7 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subde
/* mode 2 */ /* mode 2 */
devpriv->ui_AiTimer1 = cmd->scan_begin_arg; devpriv->ui_AiTimer1 = cmd->scan_begin_arg;
devpriv->ui_AiTimer0 = cmd->convert_arg; /* variable changed timer2 to timer0 */ devpriv->ui_AiTimer0 = cmd->convert_arg; /* variable changed timer2 to timer0 */
/* return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); */ /* return this_board->ai_cmd(2,dev,s); */
return i_APCI3120_CyclicAnalogInput(2, dev, s); return i_APCI3120_CyclicAnalogInput(2, dev, s);
} }
return -1; return -1;
@ -1922,7 +1922,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevic
ui_Timervalue2 = data[1] / 1000; /* convert nano seconds to u seconds */ ui_Timervalue2 = data[1] / 1000; /* convert nano seconds to u seconds */
/* this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(unsigned char)data[0]); */ /* this_board->timer_config(dev, ui_Timervalue2,(unsigned char)data[0]); */
us_TmpValue = (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); us_TmpValue = (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS);
/* /*
@ -2092,7 +2092,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice
ui_Timervalue2 = 0; ui_Timervalue2 = 0;
} }
/* this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); */ /* this_board->timer_write(dev,data[0],ui_Timervalue2); */
switch (data[0]) { switch (data[0]) {
case APCI3120_START: case APCI3120_START:
@ -2260,7 +2260,7 @@ int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice
comedi_error(dev, "\nread:timer2 not configured "); comedi_error(dev, "\nread:timer2 not configured ");
} }
/* this_board->i_hwdrv_InsnReadTimer(dev,data); */ /* this_board->timer_read(dev,data); */
if (devpriv->b_Timer2Mode == APCI3120_TIMER) { if (devpriv->b_Timer2Mode == APCI3120_TIMER) {
/* Read the LOW unsigned short of Timer 2 register */ /* Read the LOW unsigned short of Timer 2 register */
@ -2331,7 +2331,7 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev,
ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */ ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */
/* this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); */ /* this_board->di_read(dev,ui_Chan,data); */
if (ui_Chan <= 3) { if (ui_Chan <= 3) {
ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS);
@ -2379,7 +2379,7 @@ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_sub
*****/ *****/
*data = (ui_TmpValue >> 8) & 0xf; *data = (ui_TmpValue >> 8) & 0xf;
/* this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); */ /* this_board->di_bits(dev,data); */
return insn->n; return insn->n;
} }
@ -2595,7 +2595,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
ui_Range = CR_RANGE(insn->chanspec); ui_Range = CR_RANGE(insn->chanspec);
ui_Channel = CR_CHAN(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec);
/* this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); */ /* this_board->ao_write(dev, ui_Range, ui_Channel,data[0]); */
if (ui_Range) { /* if 1 then unipolar */ if (ui_Range) { /* if 1 then unipolar */
if (data[0] != 0) if (data[0] != 0)