Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84304
b: refs/heads/master
c: 621e4f8
h: refs/heads/master
v: v3
  • Loading branch information
Richard Purdie authored and David Woodhouse committed Feb 7, 2008
1 parent 7d094d7 commit 7d65578
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 388bbb09b991c792310af2f6b49f6c55edb3dff0
refs/heads/master: 621e4f8e9b208245d1f64eac7e6782b7aa506c21
26 changes: 21 additions & 5 deletions trunk/drivers/mtd/mtdoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -183,10 +184,8 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
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;
Expand All @@ -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;
Expand All @@ -205,6 +208,15 @@ static void mtdoops_workfunc_write(struct work_struct *work)
cxt->nextpage * OOPS_PAGE_SIZE, retlen, OOPS_PAGE_SIZE, ret);

mtdoops_inc_counter(cxt);
}


static void mtdoops_workfunc_write(struct work_struct *work)
{
struct mtdoops_context *cxt =
container_of(work, struct mtdoops_context, work_write);

mtdoops_write(cxt, 0);
}

static void find_next_position(struct mtdoops_context *cxt)
Expand Down Expand Up @@ -314,7 +326,11 @@ static void mtdoops_console_sync(void)
cxt->ready = 0;
spin_unlock_irqrestore(&cxt->writecount_lock, flags);

schedule_work(&cxt->work_write);
if (mtd->panic_write && in_interrupt())
/* Interrupt context, we're going to panic so try and log */
mtdoops_write(cxt, 1);
else
schedule_work(&cxt->work_write);
}

static void
Expand Down

0 comments on commit 7d65578

Please sign in to comment.