1941{
1942 struct atl2_adapter *adapter = netdev_priv(netdev);
1943
1944 if (!atl2_check_eeprom_exist(&adapter->hw))
1945 return 512;
1946 else
1947 return 0;
1948}
1949
1950static int atl2_get_eeprom(struct net_device *netdev,
1951 struct ethtool_eeprom *eeprom, u8 *bytes)
1952{
1953 struct atl2_adapter *adapter = netdev_priv(netdev);
1954 struct atl2_hw *hw = &adapter->hw;
1955 u32 *eeprom_buff;
1956 int first_dword, last_dword;
1957 int ret_val = 0;
1958 int i;
1959
1960 if (eeprom->len == 0)
1961 return -EINVAL;
1962
1963 if (atl2_check_eeprom_exist(hw))
1964 return -EINVAL;
1965
1966 eeprom->magic = hw->vendor_id | (hw->device_id << 16);
1967
1968 first_dword = eeprom->offset >> 2;
1969 last_dword = (eeprom->offset + eeprom->len - 1) >> 2;
1970
1971 eeprom_buff = kmalloc(sizeof(u32) * (last_dword - first_dword + 1),
1972 GFP_KERNEL);
1973 if (!eeprom_buff)
1974 return -ENOMEM;
1975
1976 for (i = first_dword; i < last_dword; i++) {
1977 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword])))
1978 return -EIO;
1979 }
1980
1981 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),