328 cxt->ready = 0;
329 spin_unlock_irqrestore(&cxt->writecount_lock, flags);
330
331 if (mtd->panic_write && in_interrupt())
332
333 mtdoops_write(cxt, 1);
334 else
335 schedule_work(&cxt->work_write);
336}
337
338static void
339mtdoops_console_write(struct console *co, const char *s, unsigned int count)
340{
341 struct mtdoops_context *cxt = co->data;
342 struct mtd_info *mtd = cxt->mtd;
343 unsigned long flags;
344
345 if (!oops_in_progress) {
346 mtdoops_console_sync();
347 return;
348 }
349
350 if (!cxt->ready || !mtd)
351 return;
352
353
354 spin_lock_irqsave(&cxt->writecount_lock, flags);
355
356
357 if (!cxt->ready)
358 return;
359
360 if (cxt->writecount == 0) {
361 u32 *stamp = cxt->oops_buf;
362 *stamp++ = cxt->nextcount;
363 *stamp = MTDOOPS_KERNMSG_MAGIC;
364 cxt->writecount = 8;
365 }
366
367 if ((count + cxt->writecount) > OOPS_PAGE_SIZE)
368 count = OOPS_PAGE_SIZE - cxt->writecount;