May it possible to interrupt the spi_nor_erase() function.

Signed-off-by: Marek Behún <marek.be...@nic.cz>
Tested-by: Masami Hiramatsu <masami.hirama...@linaro.org>
---
 drivers/mtd/spi/spi-nor-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 927823930c..81ecd1fe5a 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -927,6 +927,11 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
 
        while (len) {
                WATCHDOG_RESET();
+               if (ctrlc()) {
+                       addr_known = false;
+                       ret = -EINTR;
+                       goto erase_err;
+               }
 #ifdef CONFIG_SPI_FLASH_BAR
                ret = write_bar(nor, addr);
                if (ret < 0)
-- 
2.31.1

Reply via email to