Commit 6dbae1ff authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_eeprom: cleanup i_EepromReadAnlogOutputHeader()

Add namespace by renaming this CamelCase function to
addi_eeprom_read_ao_info().

Refactor the function so that it stores the data from the eeprom directly
in the private data instead of using the a struct to pass the data back
to i_EepromReadMainHeader(). This allows removing the str_AnalogOutputHeader
struct.

The return value is always 0 and it's never checked. Change it to void.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7e8ab68f
......@@ -80,11 +80,6 @@ struct str_TimerMainHeader {
struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */
};
struct str_AnalogOutputHeader {
unsigned short w_Nchannel;
unsigned char b_Resolution;
};
struct str_AnalogInputHeader {
unsigned short w_Nchannel;
unsigned short w_MinConvertTiming;
......@@ -300,20 +295,22 @@ static int i_EepromReadTimerHeader(unsigned long iobase,
}
#endif
static int i_EepromReadAnlogOutputHeader(unsigned long iobase,
char *type,
unsigned short w_Address,
struct str_AnalogOutputHeader *s_Header)
static void addi_eeprom_read_ao_info(struct comedi_device *dev,
unsigned long iobase,
char *type,
unsigned short addr)
{
unsigned short w_Temp;
struct addi_private *devpriv = dev->private;
unsigned short tmp;
/* No of channels for 1st hard component */
w_Temp = addi_eeprom_readw(iobase, type, w_Address + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF;
/* Resolution for 1st hard component */
w_Temp = addi_eeprom_readw(iobase, type, w_Address + 16);
s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF;
return 0;
/* No of channels for 1st hard component */
tmp = addi_eeprom_readw(iobase, type, addr + 10);
devpriv->s_EeParameters.i_NbrAoChannel = (tmp >> 4) & 0x3ff;
/* Resolution for 1st hard component */
tmp = addi_eeprom_readw(iobase, type, addr + 16);
tmp = (tmp >> 8) & 0xff;
devpriv->s_EeParameters.i_AoMaxdata = 0xfff >> (16 - tmp);
}
/* Reads only for ONE hardware component */
......@@ -361,7 +358,6 @@ static int i_EepromReadMainHeader(unsigned long iobase,
struct addi_private *devpriv = dev->private;
unsigned int ui_Temp;
/* struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; */
struct str_AnalogOutputHeader s_AnalogOutputHeader;
struct str_AnalogInputHeader s_AnalogInputHeader;
unsigned short size;
unsigned char nfuncs;
......@@ -413,15 +409,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break;
case EEPROM_ANALOGOUTPUT:
i_EepromReadAnlogOutputHeader(iobase, type, addr,
&s_AnalogOutputHeader);
devpriv->s_EeParameters.i_NbrAoChannel =
s_AnalogOutputHeader.w_Nchannel;
ui_Temp = 0xffff;
devpriv->s_EeParameters.i_AoMaxdata =
ui_Temp >> (16 -
s_AnalogOutputHeader.b_Resolution);
addi_eeprom_read_ao_info(dev, iobase, type, addr);
break;
case EEPROM_TIMER:
......
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