kernels/linux-2.4.0/drivers/net/tlan.c
/***************************************************************
	 *	TLan_EeReadByte
	 *
	 *	Returns:
	 *		No error = 0, else, the stage at which the error
	 *		occurred.
	 *	Parms:
	 *		io_base		The IO port base address for the
	 *				TLAN device with the EEPROM to
	 *				use.
	 *		ee_addr		The address of the byte in the
	 *				EEPROM whose contents are to be
	 *				retrieved.
	 *		data		An address to a char to hold the
	 *				data obtained from the EEPROM.
	 *
	 *	This function reads a byte of information from an byte
	 *	cell in the EEPROM.
	 *
	 **************************************************************/
TLan_EeReadByte
Returns:
No error = 0, else, the stage at which the error
occurred.
Parms:
io_base         The IO port base address for the
TLAN device with the EEPROM to
use.
ee_addr         The address of the byte in the
EEPROM whose contents are to be
retrieved.
data            An address to a char to hold the
data obtained from the EEPROM.

This function reads a byte of information from an byte
cell in the EEPROM.
TLan_EeReadByte Returns : No error = 0 else the stage at which the error occurred . Parms : io_base The IO port base address for the TLAN device with the EEPROM to use . ee_addr The address of the byte in the EEPROM whose contents are to be retrieved . data An address to a char to hold the data obtained from the EEPROM . This function reads a byte of information from an byte cell in the EEPROM .
int TLan_EeReadByte( struct net_device *dev, u8 ee_addr, u8 *data )
{
	int err;
	TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
	unsigned long flags = 0;
	int ret=0;
	spin_lock_irqsave(&priv->lock, flags);
	TLan_EeSendStart( dev->base_addr );
	err = TLan_EeSendByte( dev->base_addr, 0xA0, TLAN_EEPROM_ACK );
	if (err)
	{
		ret=1;
		goto fail;
	}
	err = TLan_EeSendByte( dev->base_addr, ee_addr, TLAN_EEPROM_ACK );
	if (err)
	{
		ret=2;
		goto fail;
	}
	TLan_EeSendStart( dev->base_addr );
	err = TLan_EeSendByte( dev->base_addr, 0xA1, TLAN_EEPROM_ACK );
	if (err)
	{
		ret=3;
		goto fail;
	}
	TLan_EeReceiveByte( dev->base_addr, data, TLAN_EEPROM_STOP );
fail:
	spin_unlock_irqrestore(&priv->lock, flags);
	return ret;
}
int TLan_EeReadByte ( struct net_device * dev , u8 ee_addr , u8 * data ) { int err ; TLanPrivateInfo * priv = ( TLanPrivateInfo * ) dev -> priv ; unsigned long flags = 0 ; int ret = 0 ; spin_lock_irqsave ( & priv -> lock , flags ) ; TLan_EeSendStart ( dev -> base_addr ) ; err = TLan_EeSendByte ( dev -> base_addr , 0xA0 , TLAN_EEPROM_ACK ) ; if ( err ) { ret = 1 ; goto fail ; } err = TLan_EeSendByte ( dev -> base_addr , ee_addr , TLAN_EEPROM_ACK ) ; if ( err ) { ret = 2 ; goto fail ; } TLan_EeSendStart ( dev -> base_addr ) ; err = TLan_EeSendByte ( dev -> base_addr , 0xA1 , TLAN_EEPROM_ACK ) ; if ( err ) { ret = 3 ; goto fail ; } TLan_EeReceiveByte ( dev -> base_addr , data , TLAN_EEPROM_STOP ) ; fail : spin_unlock_irqrestore ( & priv -> lock , flags ) ; return ret ; }
TLan_EeReadByte
      Returns:
              No error = 0, else, the stage at which the error
              occurred.
TLan_EeReadByte Returns : No error = 0 else the stage at which the error occurred .