]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sfc: Use mutex_lock_interruptible() for ethtool EEPROM access
authorBen Hutchings <bhutchings@solarflare.com>
Sat, 13 Dec 2008 06:06:24 +0000 (22:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Dec 2008 06:06:24 +0000 (22:06 -0800)
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>
drivers/net/sfc/ethtool.c

index eab3e5c61c7b0ac585954d2b224cb060e40ea76f..3aaece6b12cc99723254c4cc9d73e8c5ed2ac9b0 100644 (file)
@@ -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;
 }