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 { ...@@ -80,11 +80,6 @@ struct str_TimerMainHeader {
struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */ struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */
}; };
struct str_AnalogOutputHeader {
unsigned short w_Nchannel;
unsigned char b_Resolution;
};
struct str_AnalogInputHeader { struct str_AnalogInputHeader {
unsigned short w_Nchannel; unsigned short w_Nchannel;
unsigned short w_MinConvertTiming; unsigned short w_MinConvertTiming;
...@@ -300,20 +295,22 @@ static int i_EepromReadTimerHeader(unsigned long iobase, ...@@ -300,20 +295,22 @@ static int i_EepromReadTimerHeader(unsigned long iobase,
} }
#endif #endif
static int i_EepromReadAnlogOutputHeader(unsigned long iobase, static void addi_eeprom_read_ao_info(struct comedi_device *dev,
char *type, unsigned long iobase,
unsigned short w_Address, char *type,
struct str_AnalogOutputHeader *s_Header) unsigned short addr)
{ {
unsigned short w_Temp; struct addi_private *devpriv = dev->private;
unsigned short tmp;
/* No of channels for 1st hard component */ /* No of channels for 1st hard component */
w_Temp = addi_eeprom_readw(iobase, type, w_Address + 10); tmp = addi_eeprom_readw(iobase, type, addr + 10);
s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF; devpriv->s_EeParameters.i_NbrAoChannel = (tmp >> 4) & 0x3ff;
/* Resolution for 1st hard component */
w_Temp = addi_eeprom_readw(iobase, type, w_Address + 16); /* Resolution for 1st hard component */
s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF; tmp = addi_eeprom_readw(iobase, type, addr + 16);
return 0; tmp = (tmp >> 8) & 0xff;
devpriv->s_EeParameters.i_AoMaxdata = 0xfff >> (16 - tmp);
} }
/* Reads only for ONE hardware component */ /* Reads only for ONE hardware component */
...@@ -361,7 +358,6 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -361,7 +358,6 @@ static int i_EepromReadMainHeader(unsigned long iobase,
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
/* struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; */ /* struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; */
struct str_AnalogOutputHeader s_AnalogOutputHeader;
struct str_AnalogInputHeader s_AnalogInputHeader; struct str_AnalogInputHeader s_AnalogInputHeader;
unsigned short size; unsigned short size;
unsigned char nfuncs; unsigned char nfuncs;
...@@ -413,15 +409,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -413,15 +409,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break; break;
case EEPROM_ANALOGOUTPUT: case EEPROM_ANALOGOUTPUT:
i_EepromReadAnlogOutputHeader(iobase, type, addr, addi_eeprom_read_ao_info(dev, 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);
break; break;
case EEPROM_TIMER: 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