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

staging: comedi: addi_eeprom: cleanup v_EepromWaitBusy()

Add namespace to the function by renaming the CamelCase function to
addi_eeprom_nvram_wait().

Rename the CamelCase local variable.

Refactor the do {} while to make the code a bit more concise.
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 c9535c8b
...@@ -179,14 +179,13 @@ static unsigned short addi_eeprom_readw_93c76(unsigned long iobase, ...@@ -179,14 +179,13 @@ static unsigned short addi_eeprom_readw_93c76(unsigned long iobase,
return val; return val;
} }
static void v_EepromWaitBusy(unsigned long iobase) static void addi_eeprom_nvram_wait(unsigned long iobase)
{ {
unsigned char b_EepromBusy = 0; unsigned char val;
do { do {
b_EepromBusy = inb(iobase + 0x3F); val = inb(iobase + 0x3F);
b_EepromBusy = b_EepromBusy & 0x80; } while (val & 0x80);
} while (b_EepromBusy == 0x80);
} }
static unsigned short w_EepromReadWord(unsigned long iobase, static unsigned short w_EepromReadWord(unsigned long iobase,
...@@ -210,39 +209,27 @@ static unsigned short w_EepromReadWord(unsigned long iobase, ...@@ -210,39 +209,27 @@ static unsigned short w_EepromReadWord(unsigned long iobase,
/* Select the load low address mode */ /* Select the load low address mode */
outb(NVCMD_LOAD_LOW, iobase + 0x3F); outb(NVCMD_LOAD_LOW, iobase + 0x3F);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Load the low address */ /* Load the low address */
outb(b_SelectedAddressLow, iobase + 0x3E); outb(b_SelectedAddressLow, iobase + 0x3E);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Select the load high address mode */ /* Select the load high address mode */
outb(NVCMD_LOAD_HIGH, iobase + 0x3F); outb(NVCMD_LOAD_HIGH, iobase + 0x3F);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Load the high address */ /* Load the high address */
outb(b_SelectedAddressHigh, iobase + 0x3E); outb(b_SelectedAddressHigh, iobase + 0x3E);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Select the READ mode */ /* Select the READ mode */
outb(NVCMD_BEGIN_READ, iobase + 0x3F); outb(NVCMD_BEGIN_READ, iobase + 0x3F);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Read data into the EEPROM */ /* Read data into the EEPROM */
b_ReadByte = inb(iobase + 0x3E); b_ReadByte = inb(iobase + 0x3E);
addi_eeprom_nvram_wait(iobase);
/* Wait on busy */
v_EepromWaitBusy(iobase);
/* Select the upper address part */ /* Select the upper address part */
if (b_Counter == 0) if (b_Counter == 0)
......
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