asix: Rework reading from EEPROM

The current code for reading the EEPROM via ethtool in the asix
driver has a few issues. It cannot handle odd length values
(accesses must be aligned at 16 bit boundaries) and interprets the
offset provided by ethtool as 16 bit word offset instead as byte offset.

The new code for asix_get_eeprom() introduced by this patch is
modeled after the code in
drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
and provides read access to the entire EEPROM with arbitrary
offsets and lengths.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christian Riesch
2012-07-19 00:23:06 +00:00
committed by David S. Miller
parent 84c9f8c41d
commit ceb02c91dd
4 changed files with 24 additions and 32 deletions

View File

@@ -228,12 +228,9 @@ err:
static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)
{
int ret;
struct asix_data *data = (struct asix_data *)&dev->data;
u8 buf[ETH_ALEN];
struct ax88172a_private *priv;
data->eeprom_len = AX88772_EEPROM_LEN;
usbnet_get_endpoints(dev, intf);
priv = kzalloc(sizeof(*priv), GFP_KERNEL);