Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203151
b: refs/heads/master
c: 0c605a2
h: refs/heads/master
i:
  203149: a5fb0be
  203147: 4a76616
  203143: e81a1c1
  203135: 48ba545
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Jun 25, 2010
1 parent ed08059 commit 54fd2c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b98c1bfcfc745604985e6a50ef7481c39a9fcea
refs/heads/master: 0c605a2061670412d3b5580c92f1e161b1a693d2
23 changes: 14 additions & 9 deletions trunk/drivers/net/sfc/mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/slab.h>
#include <linux/rtnetlink.h>

#define EFX_DRIVER_NAME "sfc_mtd"
#include "net_driver.h"
#include "spi.h"
#include "efx.h"
Expand Down Expand Up @@ -71,8 +70,10 @@ static int siena_mtd_probe(struct efx_nic *efx);

/* SPI utilities */

static int efx_spi_slow_wait(struct efx_mtd *efx_mtd, bool uninterruptible)
static int
efx_spi_slow_wait(struct efx_mtd_partition *part, bool uninterruptible)
{
struct efx_mtd *efx_mtd = part->mtd.priv;
const struct efx_spi_device *spi = efx_mtd->spi;
struct efx_nic *efx = efx_mtd->efx;
u8 status;
Expand All @@ -92,7 +93,7 @@ static int efx_spi_slow_wait(struct efx_mtd *efx_mtd, bool uninterruptible)
if (signal_pending(current))
return -EINTR;
}
EFX_ERR(efx, "timed out waiting for %s\n", efx_mtd->name);
pr_err("%s: timed out waiting for %s\n", part->name, efx_mtd->name);
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -131,8 +132,10 @@ efx_spi_unlock(struct efx_nic *efx, const struct efx_spi_device *spi)
return 0;
}

static int efx_spi_erase(struct efx_mtd *efx_mtd, loff_t start, size_t len)
static int
efx_spi_erase(struct efx_mtd_partition *part, loff_t start, size_t len)
{
struct efx_mtd *efx_mtd = part->mtd.priv;
const struct efx_spi_device *spi = efx_mtd->spi;
struct efx_nic *efx = efx_mtd->efx;
unsigned pos, block_len;
Expand All @@ -156,7 +159,7 @@ static int efx_spi_erase(struct efx_mtd *efx_mtd, loff_t start, size_t len)
NULL, 0);
if (rc)
return rc;
rc = efx_spi_slow_wait(efx_mtd, false);
rc = efx_spi_slow_wait(part, false);

/* Verify the entire region has been wiped */
memset(empty, 0xff, sizeof(empty));
Expand Down Expand Up @@ -198,13 +201,14 @@ static int efx_mtd_erase(struct mtd_info *mtd, struct erase_info *erase)

static void efx_mtd_sync(struct mtd_info *mtd)
{
struct efx_mtd_partition *part = to_efx_mtd_partition(mtd);
struct efx_mtd *efx_mtd = mtd->priv;
struct efx_nic *efx = efx_mtd->efx;
int rc;

rc = efx_mtd->ops->sync(mtd);
if (rc)
EFX_ERR(efx, "%s sync failed (%d)\n", efx_mtd->name, rc);
pr_err("%s: %s sync failed (%d)\n",
part->name, efx_mtd->name, rc);
}

static void efx_mtd_remove_partition(struct efx_mtd_partition *part)
Expand Down Expand Up @@ -338,7 +342,7 @@ static int falcon_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len)
rc = mutex_lock_interruptible(&efx->spi_lock);
if (rc)
return rc;
rc = efx_spi_erase(efx_mtd, part->offset + start, len);
rc = efx_spi_erase(part, part->offset + start, len);
mutex_unlock(&efx->spi_lock);
return rc;
}
Expand All @@ -363,12 +367,13 @@ static int falcon_mtd_write(struct mtd_info *mtd, loff_t start,

static int falcon_mtd_sync(struct mtd_info *mtd)
{
struct efx_mtd_partition *part = to_efx_mtd_partition(mtd);
struct efx_mtd *efx_mtd = mtd->priv;
struct efx_nic *efx = efx_mtd->efx;
int rc;

mutex_lock(&efx->spi_lock);
rc = efx_spi_slow_wait(efx_mtd, true);
rc = efx_spi_slow_wait(part, true);
mutex_unlock(&efx->spi_lock);
return rc;
}
Expand Down

0 comments on commit 54fd2c2

Please sign in to comment.