diff options
author | Kamal Dasu <kdasu.kdev@gmail.com> | 2019-05-16 12:41:46 -0400 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-06-27 14:06:40 -0400 |
commit | 9f897bfdd89f5f08a12fa263a7f57fbf8ad9292f (patch) | |
tree | f8301f91b88e4ef576de73b8fa936ecb47b3fb4a | |
parent | 33535b85478d253a234a2779f28992a4d1766629 (diff) |
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>
-rw-r--r-- | drivers/mtd/mtdcore.c | 3 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 453242d6cf56..408615f29e57 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -1124,6 +1124,9 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, | |||
1124 | return -EROFS; | 1124 | return -EROFS; |
1125 | if (!len) | 1125 | if (!len) |
1126 | return 0; | 1126 | return 0; |
1127 | if (!mtd->oops_panic_write) | ||
1128 | mtd->oops_panic_write = true; | ||
1129 | |||
1127 | return mtd->_panic_write(mtd, to, len, retlen, buf); | 1130 | return mtd->_panic_write(mtd, to, len, retlen, buf); |
1128 | } | 1131 | } |
1129 | EXPORT_SYMBOL_GPL(mtd_panic_write); | 1132 | EXPORT_SYMBOL_GPL(mtd_panic_write); |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 936a3fdb48b5..4ca8c1c845fb 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -316,6 +316,12 @@ struct mtd_info { | |||
316 | int (*_get_device) (struct mtd_info *mtd); | 316 | int (*_get_device) (struct mtd_info *mtd); |
317 | void (*_put_device) (struct mtd_info *mtd); | 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 | struct notifier_block reboot_notifier; /* default mode before reboot */ | 325 | struct notifier_block reboot_notifier; /* default mode before reboot */ |
320 | 326 | ||
321 | /* ECC status information */ | 327 | /* ECC status information */ |