aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-06-23 07:29:24 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-25 01:13:22 -0400
commit0c605a2061670412d3b5580c92f1e161b1a693d2 (patch)
treea5bf1052ec8769e7cc69156a83321691f585679e /drivers/net/sfc
parent5b98c1bfcfc745604985e6a50ef7481c39a9fcea (diff)
sfc: Log MTD errors using partition name, not just net device name
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/mtd.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c
index f3ac7f30b5e7..02e54b4f701f 100644
--- a/drivers/net/sfc/mtd.c
+++ b/drivers/net/sfc/mtd.c
@@ -15,7 +15,6 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/rtnetlink.h> 16#include <linux/rtnetlink.h>
17 17
18#define EFX_DRIVER_NAME "sfc_mtd"
19#include "net_driver.h" 18#include "net_driver.h"
20#include "spi.h" 19#include "spi.h"
21#include "efx.h" 20#include "efx.h"
@@ -71,8 +70,10 @@ static int siena_mtd_probe(struct efx_nic *efx);
71 70
72/* SPI utilities */ 71/* SPI utilities */
73 72
74static int efx_spi_slow_wait(struct efx_mtd *efx_mtd, bool uninterruptible) 73static int
74efx_spi_slow_wait(struct efx_mtd_partition *part, bool uninterruptible)
75{ 75{
76 struct efx_mtd *efx_mtd = part->mtd.priv;
76 const struct efx_spi_device *spi = efx_mtd->spi; 77 const struct efx_spi_device *spi = efx_mtd->spi;
77 struct efx_nic *efx = efx_mtd->efx; 78 struct efx_nic *efx = efx_mtd->efx;
78 u8 status; 79 u8 status;
@@ -92,7 +93,7 @@ static int efx_spi_slow_wait(struct efx_mtd *efx_mtd, bool uninterruptible)
92 if (signal_pending(current)) 93 if (signal_pending(current))
93 return -EINTR; 94 return -EINTR;
94 } 95 }
95 EFX_ERR(efx, "timed out waiting for %s\n", efx_mtd->name); 96 pr_err("%s: timed out waiting for %s\n", part->name, efx_mtd->name);
96 return -ETIMEDOUT; 97 return -ETIMEDOUT;
97} 98}
98 99
@@ -131,8 +132,10 @@ efx_spi_unlock(struct efx_nic *efx, const struct efx_spi_device *spi)
131 return 0; 132 return 0;
132} 133}
133 134
134static int efx_spi_erase(struct efx_mtd *efx_mtd, loff_t start, size_t len) 135static int
136efx_spi_erase(struct efx_mtd_partition *part, loff_t start, size_t len)
135{ 137{
138 struct efx_mtd *efx_mtd = part->mtd.priv;
136 const struct efx_spi_device *spi = efx_mtd->spi; 139 const struct efx_spi_device *spi = efx_mtd->spi;
137 struct efx_nic *efx = efx_mtd->efx; 140 struct efx_nic *efx = efx_mtd->efx;
138 unsigned pos, block_len; 141 unsigned pos, block_len;
@@ -156,7 +159,7 @@ static int efx_spi_erase(struct efx_mtd *efx_mtd, loff_t start, size_t len)
156 NULL, 0); 159 NULL, 0);
157 if (rc) 160 if (rc)
158 return rc; 161 return rc;
159 rc = efx_spi_slow_wait(efx_mtd, false); 162 rc = efx_spi_slow_wait(part, false);
160 163
161 /* Verify the entire region has been wiped */ 164 /* Verify the entire region has been wiped */
162 memset(empty, 0xff, sizeof(empty)); 165 memset(empty, 0xff, sizeof(empty));
@@ -198,13 +201,14 @@ static int efx_mtd_erase(struct mtd_info *mtd, struct erase_info *erase)
198 201
199static void efx_mtd_sync(struct mtd_info *mtd) 202static void efx_mtd_sync(struct mtd_info *mtd)
200{ 203{
204 struct efx_mtd_partition *part = to_efx_mtd_partition(mtd);
201 struct efx_mtd *efx_mtd = mtd->priv; 205 struct efx_mtd *efx_mtd = mtd->priv;
202 struct efx_nic *efx = efx_mtd->efx;
203 int rc; 206 int rc;
204 207
205 rc = efx_mtd->ops->sync(mtd); 208 rc = efx_mtd->ops->sync(mtd);
206 if (rc) 209 if (rc)
207 EFX_ERR(efx, "%s sync failed (%d)\n", efx_mtd->name, rc); 210 pr_err("%s: %s sync failed (%d)\n",
211 part->name, efx_mtd->name, rc);
208} 212}
209 213
210static void efx_mtd_remove_partition(struct efx_mtd_partition *part) 214static void efx_mtd_remove_partition(struct efx_mtd_partition *part)
@@ -338,7 +342,7 @@ static int falcon_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len)
338 rc = mutex_lock_interruptible(&efx->spi_lock); 342 rc = mutex_lock_interruptible(&efx->spi_lock);
339 if (rc) 343 if (rc)
340 return rc; 344 return rc;
341 rc = efx_spi_erase(efx_mtd, part->offset + start, len); 345 rc = efx_spi_erase(part, part->offset + start, len);
342 mutex_unlock(&efx->spi_lock); 346 mutex_unlock(&efx->spi_lock);
343 return rc; 347 return rc;
344} 348}
@@ -363,12 +367,13 @@ static int falcon_mtd_write(struct mtd_info *mtd, loff_t start,
363 367
364static int falcon_mtd_sync(struct mtd_info *mtd) 368static int falcon_mtd_sync(struct mtd_info *mtd)
365{ 369{
370 struct efx_mtd_partition *part = to_efx_mtd_partition(mtd);
366 struct efx_mtd *efx_mtd = mtd->priv; 371 struct efx_mtd *efx_mtd = mtd->priv;
367 struct efx_nic *efx = efx_mtd->efx; 372 struct efx_nic *efx = efx_mtd->efx;
368 int rc; 373 int rc;
369 374
370 mutex_lock(&efx->spi_lock); 375 mutex_lock(&efx->spi_lock);
371 rc = efx_spi_slow_wait(efx_mtd, true); 376 rc = efx_spi_slow_wait(part, true);
372 mutex_unlock(&efx->spi_lock); 377 mutex_unlock(&efx->spi_lock);
373 return rc; 378 return rc;
374} 379}