[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ARM: mmci: round down the bytes transferred on error
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2011-01-31 22:59:51
Message-ID: 201101312259.p0VMxpxn004584 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/613b152c63e35095a929f9bb80441cbe91ff5e80
Commit:     613b152c63e35095a929f9bb80441cbe91ff5e80
Parent:     ccff9b51825b7335889b780bdf7de84ca803e291
Author:     Russell King <rmk+kernel@arm.linux.org.uk>
AuthorDate: Sun Jan 30 21:06:53 2011 +0000
Committer:  Russell King <rmk+kernel@arm.linux.org.uk>
CommitDate: Mon Jan 31 10:53:37 2011 +0000

    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>
---
 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 175a623..2d6de3e 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -14,6 +14,7 @@
 #include <linux/ioport.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
+#include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/highmem.h>
@@ -289,13 +290,13 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data,
 		dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status);
 		if (status & MCI_DATACRCFAIL) {
 			/* Last block was not successful */
-			host->data_xfered = ((success - 1) / data->blksz) * data->blksz;
+			host->data_xfered = round_down(success - 1, data->blksz);
 			data->error = -EILSEQ;
 		} else if (status & MCI_DATATIMEOUT) {
-			host->data_xfered = success;
+			host->data_xfered = round_down(success, data->blksz);
 			data->error = -ETIMEDOUT;
 		} else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) {
-			host->data_xfered = success;
+			host->data_xfered = round_down(success, data->blksz);
 			data->error = -EIO;
 		}
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic