diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-30 16:06:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-31 05:53:37 -0500 |
commit | 613b152c63e35095a929f9bb80441cbe91ff5e80 (patch) | |
tree | 0427d88375de0be5f4f11dae661e5405d32d3431 /drivers/mmc/host/mmci.c | |
parent | ccff9b51825b7335889b780bdf7de84ca803e291 (diff) |
ARM: mmci: round down the bytes transferred on error
We should not report incomplete blocks on error. Return the number of
bytes successfully transferred, rounded down to the nearest block.
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r-- | drivers/mmc/host/mmci.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 175a623a6a29..2d6de3e03e2d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/ioport.h> | 14 | #include <linux/ioport.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/kernel.h> | ||
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
@@ -289,13 +290,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | 290 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); |
290 | if (status & MCI_DATACRCFAIL) { | 291 | if (status & MCI_DATACRCFAIL) { |
291 | /* Last block was not successful */ | 292 | /* Last block was not successful */ |
292 | host->data_xfered = ((success - 1) / data->blksz) * data->blksz; | 293 | host->data_xfered = round_down(success - 1, data->blksz); |
293 | data->error = -EILSEQ; | 294 | data->error = -EILSEQ; |
294 | } else if (status & MCI_DATATIMEOUT) { | 295 | } else if (status & MCI_DATATIMEOUT) { |
295 | host->data_xfered = success; | 296 | host->data_xfered = round_down(success, data->blksz); |
296 | data->error = -ETIMEDOUT; | 297 | data->error = -ETIMEDOUT; |
297 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 298 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
298 | host->data_xfered = success; | 299 | host->data_xfered = round_down(success, data->blksz); |
299 | data->error = -EIO; | 300 | data->error = -EIO; |
300 | } | 301 | } |
301 | 302 | ||