Commit 7e8ab68f authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_eeprom: cleanup i_EepromReadDigitalOutputHeader()

Add namespace by renaming this CamelCase function to
addi_eeprom_read_do_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_DigitalOutputHeader
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 ef4e05f0
...@@ -66,10 +66,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -66,10 +66,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour
#define EEPROM_WATCHDOG 5 #define EEPROM_WATCHDOG 5
#define EEPROM_TIMER_WATCHDOG_COUNTER 10 #define EEPROM_TIMER_WATCHDOG_COUNTER 10
struct str_DigitalOutputHeader {
unsigned short w_Nchannel;
};
/* used for timer as well as watchdog */ /* used for timer as well as watchdog */
struct str_TimerDetails { struct str_TimerDetails {
unsigned short w_HeaderSize; unsigned short w_HeaderSize;
...@@ -246,15 +242,19 @@ static void addi_eeprom_read_di_info(struct comedi_device *dev, ...@@ -246,15 +242,19 @@ static void addi_eeprom_read_di_info(struct comedi_device *dev,
tmp = addi_eeprom_readw(iobase, type, addr + 10); tmp = addi_eeprom_readw(iobase, type, addr + 10);
} }
static int i_EepromReadDigitalOutputHeader(unsigned long iobase, static void addi_eeprom_read_do_info(struct comedi_device *dev,
char *type, unsigned long iobase,
unsigned short w_Address, char *type,
struct str_DigitalOutputHeader *s_Header) unsigned short addr)
{ {
/* Read Nbr channels */ struct addi_private *devpriv = dev->private;
s_Header->w_Nchannel = addi_eeprom_readw(iobase, type, unsigned short tmp;
w_Address + 6);
return 0; /* Number of channels */
tmp = addi_eeprom_readw(iobase, type, addr + 6);
devpriv->s_EeParameters.i_NbrDoChannel = tmp;
devpriv->s_EeParameters.i_DoMaxdata = 0xffffffff >> (32 - tmp);
} }
#if 0 #if 0
...@@ -360,7 +360,6 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -360,7 +360,6 @@ static int i_EepromReadMainHeader(unsigned long iobase,
const struct addi_board *this_board = comedi_board(dev); const struct addi_board *this_board = comedi_board(dev);
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_Temp; unsigned int ui_Temp;
struct str_DigitalOutputHeader s_DigitalOutputHeader;
/* struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; */ /* struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; */
struct str_AnalogOutputHeader s_AnalogOutputHeader; struct str_AnalogOutputHeader s_AnalogOutputHeader;
struct str_AnalogInputHeader s_AnalogInputHeader; struct str_AnalogInputHeader s_AnalogInputHeader;
...@@ -386,15 +385,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -386,15 +385,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
break; break;
case EEPROM_DIGITALOUTPUT: case EEPROM_DIGITALOUTPUT:
i_EepromReadDigitalOutputHeader(iobase, type, addr, addi_eeprom_read_do_info(dev, iobase, type, addr);
&s_DigitalOutputHeader);
devpriv->s_EeParameters.i_NbrDoChannel =
s_DigitalOutputHeader.w_Nchannel;
ui_Temp = 0xffffffff;
devpriv->s_EeParameters.i_DoMaxdata =
ui_Temp >> (32 -
devpriv->s_EeParameters.i_NbrDoChannel);
break; break;
case EEPROM_ANALOGINPUT: case EEPROM_ANALOGINPUT:
......
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