mtd: atmel_nand: use CPU I/O when buffer is in vmalloc(ed) region

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Apr 7 05:59:02 EDT 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=80b4f81a49809774f1b123c456fb179e472dbd0e
Commit:     80b4f81a49809774f1b123c456fb179e472dbd0e
Parent:     9d51567e47a0d84f6b6e7751a4ea4f710cdcbbdf
Author:     Hong Xu <hong.xu at atmel.com>
AuthorDate: Thu Mar 31 18:33:15 2011 +0800
Committer:  Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
CommitDate: Fri Apr 1 17:25:24 2011 +0300

    mtd: atmel_nand: use CPU I/O when buffer is in vmalloc(ed) region
    
    The previous way of dealing with vmalloc(ed) region by walking
    though the pages can not work well actually. We just fall back
    to CPU I/O when the buffer address is higher than `high_memory'.
    
    Signed-off-by: Nicolas Ferre <nicolas.ferre at atmel.com>
    Signed-off-by: Hong Xu <hong.xu at atmel.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 drivers/mtd/nand/atmel_nand.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index e9fdbe4..950646a 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -209,22 +209,8 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len,
 	int err = -EIO;
 	enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 
-	if (buf >= high_memory) {
-		struct page *pg;
-
-		if (((size_t)buf & PAGE_MASK) !=
-		    ((size_t)(buf + len - 1) & PAGE_MASK)) {
-			dev_warn(host->dev, "Buffer not fit in one page\n");
-			goto err_buf;
-		}
-
-		pg = vmalloc_to_page(buf);
-		if (pg == 0) {
-			dev_err(host->dev, "Failed to vmalloc_to_page\n");
-			goto err_buf;
-		}
-		p = page_address(pg) + ((size_t)buf & ~PAGE_MASK);
-	}
+	if (buf >= high_memory)
+		goto err_buf;
 
 	dma_dev = host->dma_chan->device;
 



More information about the linux-mtd-cvs mailing list