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

staging: comedi: addi_eeprom: cleanup i_EepromReadDigitalInputHeader()

Add namespace by renaming this CamelCase function to
addi_eeprom_read_di_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_DigitalInputHeader
struct.

Leave the reads of the unused eeprom data for now.

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 7cd25bf0
...@@ -66,12 +66,6 @@ You should also find the complete GPL in the COPYING file accompanying this sour ...@@ -66,12 +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_DigitalInputHeader {
unsigned short w_Nchannel;
unsigned char b_Interruptible;
unsigned short w_NinterruptLogic;
};
struct str_DigitalOutputHeader { struct str_DigitalOutputHeader {
unsigned short w_Nchannel; unsigned short w_Nchannel;
}; };
...@@ -232,25 +226,24 @@ static unsigned short addi_eeprom_readw(unsigned long iobase, ...@@ -232,25 +226,24 @@ static unsigned short addi_eeprom_readw(unsigned long iobase,
return val; return val;
} }
static int i_EepromReadDigitalInputHeader(unsigned long iobase, static void addi_eeprom_read_di_info(struct comedi_device *dev,
char *type, unsigned long iobase,
unsigned short w_Address, char *type,
struct str_DigitalInputHeader *s_Header) unsigned short addr)
{ {
unsigned short w_Temp; struct addi_private *devpriv = dev->private;
unsigned short tmp;
/* read nbr of channels */ /* Number of channels */
s_Header->w_Nchannel = addi_eeprom_readw(iobase, type, w_Address + 6); tmp = addi_eeprom_readw(iobase, type, addr + 6);
devpriv->s_EeParameters.i_NbrDiChannel = tmp;
/* interruptible or not */ /* Interruptible or not */
w_Temp = addi_eeprom_readw(iobase, type, w_Address + 8); tmp = addi_eeprom_readw(iobase, type, addr + 8);
s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01; tmp = (tmp >> 7) & 0x01;
/* How many interruptible logic */ /* How many interruptible logic */
s_Header->w_NinterruptLogic = addi_eeprom_readw(iobase, type, tmp = addi_eeprom_readw(iobase, type, addr + 10);
w_Address + 10);
return 0;
} }
static int i_EepromReadDigitalOutputHeader(unsigned long iobase, static int i_EepromReadDigitalOutputHeader(unsigned long iobase,
...@@ -367,7 +360,6 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -367,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_DigitalInputHeader s_DigitalInputHeader;
struct str_DigitalOutputHeader s_DigitalOutputHeader; 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;
...@@ -390,11 +382,7 @@ static int i_EepromReadMainHeader(unsigned long iobase, ...@@ -390,11 +382,7 @@ static int i_EepromReadMainHeader(unsigned long iobase,
switch (func) { switch (func) {
case EEPROM_DIGITALINPUT: case EEPROM_DIGITALINPUT:
i_EepromReadDigitalInputHeader(iobase, type, addr, addi_eeprom_read_di_info(dev, iobase, type, addr);
&s_DigitalInputHeader);
devpriv->s_EeParameters.i_NbrDiChannel =
s_DigitalInputHeader.w_Nchannel;
break; break;
case EEPROM_DIGITALOUTPUT: case EEPROM_DIGITALOUTPUT:
......
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