Commit 9f897bfdd89f5f08a12fa263a7f57fbf8ad9292f

Authored by Kamal Dasu
Committed by Miquel Raynal
1 parent 33535b8547

mtd: Add flag to indicate panic_write

Added a flag to indicate a panic_write so that low level drivers can
use it to take required action where applicable, to ensure oops data
gets written to assigned mtd device.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Showing 2 changed files with 9 additions and 0 deletions Side-by-side Diff

drivers/mtd/mtdcore.c
... ... @@ -1124,6 +1124,9 @@
1124 1124 return -EROFS;
1125 1125 if (!len)
1126 1126 return 0;
  1127 + if (!mtd->oops_panic_write)
  1128 + mtd->oops_panic_write = true;
  1129 +
1127 1130 return mtd->_panic_write(mtd, to, len, retlen, buf);
1128 1131 }
1129 1132 EXPORT_SYMBOL_GPL(mtd_panic_write);
include/linux/mtd/mtd.h
... ... @@ -316,6 +316,12 @@
316 316 int (*_get_device) (struct mtd_info *mtd);
317 317 void (*_put_device) (struct mtd_info *mtd);
318 318  
  319 + /*
  320 + * flag indicates a panic write, low level drivers can take appropriate
  321 + * action if required to ensure writes go through
  322 + */
  323 + bool oops_panic_write;
  324 +
319 325 struct notifier_block reboot_notifier; /* default mode before reboot */
320 326  
321 327 /* ECC status information */