Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68483
b: refs/heads/master
c: 8691a72
h: refs/heads/master
i:
  68481: 164a9eb
  68479: 10c9597
v: v3
  • Loading branch information
Richard Purdie authored and David Woodhouse committed Jul 11, 2007
1 parent a858117 commit a78a116
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 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: a2e96b627b58efe2d618a415f34b9b9d9f829bd6
refs/heads/master: 8691a729a2a3d739ee40a577053157393450aabd
57 changes: 34 additions & 23 deletions trunk/drivers/mtd/mtdoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,40 +250,50 @@ static void mtdoops_notify_remove(struct mtd_info *mtd)
flush_scheduled_work();
}


static void
mtdoops_console_write(struct console *co, const char *s, unsigned int count)
static void mtdoops_console_sync(void)
{
struct mtdoops_context *cxt = co->data;
struct mtdoops_context *cxt = &oops_cxt;
struct mtd_info *mtd = cxt->mtd;
int i, ret;
size_t retlen;
int ret;

if (!cxt->ready || !mtd)
return;

if (!oops_in_progress && cxt->writecount != 0) {
size_t retlen;
if (cxt->writecount < OOPS_PAGE_SIZE)
memset(cxt->oops_buf + cxt->writecount, 0xff,
if (cxt->writecount == 0)
return;

if (cxt->writecount < OOPS_PAGE_SIZE)
memset(cxt->oops_buf + cxt->writecount, 0xff,
OOPS_PAGE_SIZE - cxt->writecount);

ret = mtd->write(mtd, cxt->nextpage * OOPS_PAGE_SIZE,
ret = mtd->write(mtd, cxt->nextpage * OOPS_PAGE_SIZE,
OOPS_PAGE_SIZE, &retlen, cxt->oops_buf);
cxt->ready = 0;
cxt->writecount = 0;

if ((retlen != OOPS_PAGE_SIZE) || (ret < 0))
printk(KERN_ERR "mtdoops: Write failure at %d (%d of %d"
" written), err %d.\n",
cxt->nextpage * OOPS_PAGE_SIZE, retlen,
OOPS_PAGE_SIZE, ret);

ret = mtdoops_inc_counter(cxt);
if (ret == 1)
schedule_work(&cxt->work);
cxt->ready = 0;
cxt->writecount = 0;

if ((retlen != OOPS_PAGE_SIZE) || (ret < 0))
printk(KERN_ERR "mtdoops: Write failure at %d (%d of %d written), err %d.\n",
cxt->nextpage * OOPS_PAGE_SIZE, retlen, OOPS_PAGE_SIZE, ret);

ret = mtdoops_inc_counter(cxt);
if (ret == 1)
schedule_work(&cxt->work);
}

static void
mtdoops_console_write(struct console *co, const char *s, unsigned int count)
{
struct mtdoops_context *cxt = co->data;
struct mtd_info *mtd = cxt->mtd;
int i;

if (!oops_in_progress) {
mtdoops_console_sync();
return;
}

if (!oops_in_progress)
if (!cxt->ready || !mtd)
return;

if (cxt->writecount == 0) {
Expand Down Expand Up @@ -323,6 +333,7 @@ static struct console mtdoops_console = {
.name = "ttyMTD",
.write = mtdoops_console_write,
.setup = mtdoops_console_setup,
.unblank = mtdoops_console_sync,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &oops_cxt,
Expand Down

0 comments on commit a78a116

Please sign in to comment.