Skip to content

Commit 9f897bf

Browse files
KamalDasumiquelraynal
authored andcommitted
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>
1 parent 33535b8 commit 9f897bf

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/mtd/mtdcore.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
11241124
return -EROFS;
11251125
if (!len)
11261126
return 0;
1127+
if (!mtd->oops_panic_write)
1128+
mtd->oops_panic_write = true;
1129+
11271130
return mtd->_panic_write(mtd, to, len, retlen, buf);
11281131
}
11291132
EXPORT_SYMBOL_GPL(mtd_panic_write);

‎include/linux/mtd/mtd.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ struct mtd_info {
316316
int (*_get_device) (struct mtd_info *mtd);
317317
void (*_put_device) (struct mtd_info *mtd);
318318

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+
319325
struct notifier_block reboot_notifier; /* default mode before reboot */
320326

321327
/* ECC status information */

0 commit comments

Comments
 (0)