diff options
author | Steve Glendinning <steve.glendinning@smsc.com> | 2009-02-15 17:55:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-20 03:38:51 -0500 |
commit | 196b7e1b9cca9e187bb61fa7d60f04f4ab2c0592 (patch) | |
tree | 50ba17d2078c3cd7465bfe1cafb6fc720ef83f63 /drivers/net/smsc9420.c | |
parent | 62660e28084df3d8067ab855f326d3027808c569 (diff) |
smsc9420: handle magic field of ethtool_eeprom
ethtool.h says the driver should set the magic field in get_eeprom and
verify it in set_eeprom. This patch adds this functionality using an
arbitary driver-specific magic value constant (0x9420).
Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/smsc9420.c')
-rw-r--r-- | drivers/net/smsc9420.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index 83938e1953b..4e15ae068b3 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
@@ -413,6 +413,7 @@ static int smsc9420_ethtool_get_eeprom(struct net_device *dev, | |||
413 | } | 413 | } |
414 | 414 | ||
415 | memcpy(data, &eeprom_data[eeprom->offset], len); | 415 | memcpy(data, &eeprom_data[eeprom->offset], len); |
416 | eeprom->magic = SMSC9420_EEPROM_MAGIC; | ||
416 | eeprom->len = len; | 417 | eeprom->len = len; |
417 | return 0; | 418 | return 0; |
418 | } | 419 | } |
@@ -423,6 +424,9 @@ static int smsc9420_ethtool_set_eeprom(struct net_device *dev, | |||
423 | struct smsc9420_pdata *pd = netdev_priv(dev); | 424 | struct smsc9420_pdata *pd = netdev_priv(dev); |
424 | int ret; | 425 | int ret; |
425 | 426 | ||
427 | if (eeprom->magic != SMSC9420_EEPROM_MAGIC) | ||
428 | return -EINVAL; | ||
429 | |||
426 | smsc9420_eeprom_enable_access(pd); | 430 | smsc9420_eeprom_enable_access(pd); |
427 | smsc9420_eeprom_send_cmd(pd, E2P_CMD_EPC_CMD_EWEN_); | 431 | smsc9420_eeprom_send_cmd(pd, E2P_CMD_EPC_CMD_EWEN_); |
428 | ret = smsc9420_eeprom_write_location(pd, eeprom->offset, *data); | 432 | ret = smsc9420_eeprom_write_location(pd, eeprom->offset, *data); |