Skip to content

Commit

Permalink
mtd: Add flag to indicate panic_write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kamal Dasu authored and Miquel Raynal committed Jun 27, 2019
1 parent 33535b8 commit 9f897bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,9 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
return -EROFS;
if (!len)
return 0;
if (!mtd->oops_panic_write)
mtd->oops_panic_write = true;

return mtd->_panic_write(mtd, to, len, retlen, buf);
}
EXPORT_SYMBOL_GPL(mtd_panic_write);
Expand Down
6 changes: 6 additions & 0 deletions include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ struct mtd_info {
int (*_get_device) (struct mtd_info *mtd);
void (*_put_device) (struct mtd_info *mtd);

/*
* flag indicates a panic write, low level drivers can take appropriate
* action if required to ensure writes go through
*/
bool oops_panic_write;

struct notifier_block reboot_notifier; /* default mode before reboot */

/* ECC status information */
Expand Down

0 comments on commit 9f897bf

Please sign in to comment.