aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/ethtool.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-13 01:06:24 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-13 01:06:24 -0500
commitca54a9f525236c389f464d0952c8a7d6a4035906 (patch)
tree384db8cff1c974af9b1b7fa442e94cc104311ac5 /drivers/net/sfc/ethtool.c
parent11e66966277ea8a3353ad2c2773257973553e73a (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/ethtool.c')
-rw-r--r--drivers/net/sfc/ethtool.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index eab3e5c61c7b..3aaece6b12cc 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,
568 size_t len; 568 size_t len;
569 int rc; 569 int rc;
570 570
571 mutex_lock(&efx->spi_lock); 571 rc = mutex_lock_interruptible(&efx->spi_lock);
572 if (rc)
573 return rc;
572 rc = falcon_spi_read(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START, 574 rc = falcon_spi_read(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START,
573 eeprom->len, &len, buf); 575 eeprom->len, &len, buf);
574 mutex_unlock(&efx->spi_lock); 576 mutex_unlock(&efx->spi_lock);
577
575 eeprom->magic = EFX_ETHTOOL_EEPROM_MAGIC; 578 eeprom->magic = EFX_ETHTOOL_EEPROM_MAGIC;
576 eeprom->len = len; 579 eeprom->len = len;
577 return rc; 580 return rc;
@@ -588,10 +591,13 @@ static int efx_ethtool_set_eeprom(struct net_device *net_dev,
588 if (eeprom->magic != EFX_ETHTOOL_EEPROM_MAGIC) 591 if (eeprom->magic != EFX_ETHTOOL_EEPROM_MAGIC)
589 return -EINVAL; 592 return -EINVAL;
590 593
591 mutex_lock(&efx->spi_lock); 594 rc = mutex_lock_interruptible(&efx->spi_lock);
595 if (rc)
596 return rc;
592 rc = falcon_spi_write(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START, 597 rc = falcon_spi_write(spi, eeprom->offset + EFX_EEPROM_BOOTCONFIG_START,
593 eeprom->len, &len, buf); 598 eeprom->len, &len, buf);
594 mutex_unlock(&efx->spi_lock); 599 mutex_unlock(&efx->spi_lock);
600
595 eeprom->len = len; 601 eeprom->len = len;
596 return rc; 602 return rc;
597} 603}