[MTD] mtdoops: Use the panic_write function when present

Previous thread: [SPARC32]: Add user regset support. by Linux Kernel Mailing List on Thursday, February 7, 2008 - 12:12 pm. (1 message)

Next thread: [MTD] Add mtd panic_write function pointer by Linux Kernel Mailing List on Thursday, February 7, 2008 - 12:11 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, February 7, 2008 - 12:11 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=621e4f...
Commit:     621e4f8e9b208245d1f64eac7e6782b7aa506c21
Parent:     388bbb09b991c792310af2f6b49f6c55edb3dff0
Author:     Richard Purdie <rpurdie@rpsys.net>
AuthorDate: Wed Feb 6 10:17:50 2008 +0000
Committer:  David Woodhouse <dwmw2@infradead.org>
CommitDate: Thu Feb 7 10:31:04 2008 +0000

    [MTD] mtdoops: Use the panic_write function when present
    
    When the MTD provides a panic_write function, use it.
    
    Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
    Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
 drivers/mtd/mtdoops.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 34681bc..fd98e38 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -28,6 +28,7 @@
 #include <linux/workqueue.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
+#include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/mtd/mtd.h>
 
@@ -183,10 +184,8 @@ badblock:
 	goto badblock;
 }
 
-static void mtdoops_workfunc_write(struct work_struct *work)
+static void mtdoops_write(struct mtdoops_context *cxt, int panic)
 {
-	struct mtdoops_context *cxt =
-			container_of(work, struct mtdoops_context, work_write);
 	struct mtd_info *mtd = cxt->mtd;
 	size_t retlen;
 	int ret;
@@ -195,7 +194,11 @@ static void mtdoops_workfunc_write(struct work_struct *work)
 		memset(cxt->oops_buf + cxt->writecount, 0xff,
 					OOPS_PAGE_SIZE - cxt->writecount);
 
-	ret = mtd->write(mtd, cxt->nextpage * OOPS_PAGE_SIZE,
+	if (panic)
+		ret = mtd->panic_write(mtd, cxt->nextpage * OOPS_PAGE_SIZE,
+					OOPS_PAGE_SIZE, &retlen, cxt->oops_buf);
+	else
+		ret = mtd->write(mtd, cxt->nextpage * OOPS_PAGE_SIZE,
 					OOPS_PAGE_SIZE, &retlen, cxt->oops_buf);
 
 	cxt->writecount = 0;
@@ -205,6 +208,15 @@ static void ...
Previous thread: [SPARC32]: Add user regset support. by Linux Kernel Mailing List on Thursday, February 7, 2008 - 12:12 pm. (1 message)

Next thread: [MTD] Add mtd panic_write function pointer by Linux Kernel Mailing List on Thursday, February 7, 2008 - 12:11 pm. (1 message)