提交 ca54a9f5 编写于 作者: B Ben Hutchings 提交者: David S. Miller

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: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 11e66966
...@@ -568,10 +568,13 @@ static int efx_ethtool_get_eeprom(struct net_device *net_dev, ...@@ -568,10 +568,13 @@ static int efx_ethtool_get_eeprom(struct net_device *net_dev,
size_t len; size_t len;
int rc; 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, rc = falcon_spi_read(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START,
eeprom->len, &len, buf); eeprom->len, &len, buf);
mutex_unlock(&efx->spi_lock); mutex_unlock(&efx->spi_lock);
eeprom->magic = EFX_ETHTOOL_EEPROM_MAGIC; eeprom->magic = EFX_ETHTOOL_EEPROM_MAGIC;
eeprom->len = len; eeprom->len = len;
return rc; return rc;
...@@ -588,10 +591,13 @@ static int efx_ethtool_set_eeprom(struct net_device *net_dev, ...@@ -588,10 +591,13 @@ static int efx_ethtool_set_eeprom(struct net_device *net_dev,
if (eeprom->magic != EFX_ETHTOOL_EEPROM_MAGIC) if (eeprom->magic != EFX_ETHTOOL_EEPROM_MAGIC)
return -EINVAL; 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, rc = falcon_spi_write(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START,
eeprom->len, &len, buf); eeprom->len, &len, buf);
mutex_unlock(&efx->spi_lock); mutex_unlock(&efx->spi_lock);
eeprom->len = len; eeprom->len = len;
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册