]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/mtd/onenand/omap2.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[net-next-2.6.git] / drivers / mtd / onenand / omap2.c
index 75f38b95811ea729b0e9f2494399253d93ed8472..9f322f1a7f220d48fb30334bc80d85769df4a8c6 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 
 #include <asm/mach/flash.h>
 #include <plat/gpmc.h>
@@ -308,7 +309,7 @@ static int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area,
                goto out_copy;
 
        /* panic_write() may be in an interrupt context */
-       if (in_interrupt())
+       if (in_interrupt() || oops_in_progress)
                goto out_copy;
 
        if (buf >= high_memory) {
@@ -385,7 +386,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
                goto out_copy;
 
        /* panic_write() may be in an interrupt context */
-       if (in_interrupt())
+       if (in_interrupt() || oops_in_progress)
                goto out_copy;
 
        if (buf >= high_memory) {
@@ -402,7 +403,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
 
        dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
        dma_dst = c->phys_base + bram_offset;
-       if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
+       if (dma_mapping_error(&c->pdev->dev, dma_src)) {
                dev_err(&c->pdev->dev,
                        "Couldn't DMA map a %d byte buffer\n",
                        count);
@@ -425,7 +426,7 @@ static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
                if (*done)
                        break;
 
-       dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
+       dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
 
        if (!*done) {
                dev_err(&c->pdev->dev, "timeout waiting for DMA\n");
@@ -520,7 +521,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
        dma_src = dma_map_single(&c->pdev->dev, (void *) buffer, count,
                                 DMA_TO_DEVICE);
        dma_dst = c->phys_base + bram_offset;
-       if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
+       if (dma_mapping_error(&c->pdev->dev, dma_src)) {
                dev_err(&c->pdev->dev,
                        "Couldn't DMA map a %d byte buffer\n",
                        count);
@@ -538,7 +539,7 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
        omap_start_dma(c->dma_channel);
        wait_for_completion(&c->dma_done);
 
-       dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_TO_DEVICE);
+       dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
 
        return 0;
 }