diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-12-12 22:06:24 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-12 22:06:24 -0800 |
commit | ca54a9f525236c389f464d0952c8a7d6a4035906 (patch) | |
tree | 384db8cff1c974af9b1b7fa442e94cc104311ac5 /drivers/net/sfc | |
parent | 11e66966277ea8a3353ad2c2773257973553e73a (diff) |
sfc: Use mutex_lock_interruptible() for ethtool EEPROM access
ethtool must contend with the MTD driver for the SPI bus lock, which
may carry out long operations such as flash erase. Allow it to be
interrupted while waiting.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/ethtool.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index eab3e5c61c7..3aaece6b12c 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c @@ -568,10 +568,13 @@ static int efx_ethtool_get_eeprom(struct net_device *net_dev, size_t len; int rc; - mutex_lock(&efx->spi_lock); + rc = mutex_lock_interruptible(&efx->spi_lock); + if (rc) + return rc; rc = falcon_spi_read(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START, eeprom->len, &len, buf); mutex_unlock(&efx->spi_lock); + eeprom->magic = EFX_ETHTOOL_EEPROM_MAGIC; eeprom->len = len; return rc; @@ -588,10 +591,13 @@ static int efx_ethtool_set_eeprom(struct net_device *net_dev, if (eeprom->magic != EFX_ETHTOOL_EEPROM_MAGIC) return -EINVAL; - mutex_lock(&efx->spi_lock); + rc = mutex_lock_interruptible(&efx->spi_lock); + if (rc) + return rc; rc = falcon_spi_write(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START, eeprom->len, &len, buf); mutex_unlock(&efx->spi_lock); + eeprom->len = len; return rc; } |