--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
-@@ -1445,6 +1445,23 @@ destroy_erase_cmd_list:
+@@ -1449,6 +1449,23 @@ destroy_erase_cmd_list:
return ret;
}
/*
* Erase an address range on the nor chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
-@@ -1472,6 +1489,10 @@ static int spi_nor_erase(struct mtd_info
+@@ -1476,6 +1493,10 @@ static int spi_nor_erase(struct mtd_info
if (ret)
return ret;
/* whole-chip erase? */
if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
unsigned long timeout;
-@@ -1531,6 +1552,7 @@ static int spi_nor_erase(struct mtd_info
+@@ -1535,6 +1556,7 @@ static int spi_nor_erase(struct mtd_info
ret = spi_nor_write_disable(nor);
erase_err:
spi_nor_unlock_and_unprep(nor);
return ret;
-@@ -1870,7 +1892,9 @@ static int spi_nor_lock(struct mtd_info
+@@ -1874,7 +1896,9 @@ static int spi_nor_lock(struct mtd_info
if (ret)
return ret;
spi_nor_unlock_and_unprep(nor);
return ret;
-@@ -1885,7 +1909,9 @@ static int spi_nor_unlock(struct mtd_inf
+@@ -1889,7 +1913,9 @@ static int spi_nor_unlock(struct mtd_inf
if (ret)
return ret;
spi_nor_unlock_and_unprep(nor);
return ret;
-@@ -1900,7 +1926,9 @@ static int spi_nor_is_locked(struct mtd_
+@@ -1904,7 +1930,9 @@ static int spi_nor_is_locked(struct mtd_
if (ret)
return ret;
spi_nor_unlock_and_unprep(nor);
return ret;
-@@ -2093,6 +2121,10 @@ static int spi_nor_read(struct mtd_info
+@@ -2097,6 +2125,10 @@ static int spi_nor_read(struct mtd_info
if (ret)
return ret;
while (len) {
loff_t addr = from;
-@@ -2116,6 +2148,7 @@ static int spi_nor_read(struct mtd_info
+@@ -2120,6 +2152,7 @@ static int spi_nor_read(struct mtd_info
ret = 0;
read_err:
spi_nor_unlock_and_unprep(nor);
return ret;
}
-@@ -2138,6 +2171,10 @@ static int spi_nor_write(struct mtd_info
+@@ -2142,6 +2175,10 @@ static int spi_nor_write(struct mtd_info
if (ret)
return ret;
for (i = 0; i < len; ) {
ssize_t written;
loff_t addr = to + i;
-@@ -2180,6 +2217,7 @@ static int spi_nor_write(struct mtd_info
+@@ -2184,6 +2221,7 @@ static int spi_nor_write(struct mtd_info
}
write_err:
spi_nor_unlock_and_unprep(nor);
return ret;
}
-@@ -2975,9 +3013,13 @@ static int spi_nor_init(struct spi_nor *
+@@ -2983,9 +3021,13 @@ static int spi_nor_init(struct spi_nor *
* reboots (e.g., crashes). Warn the user (or hopefully, system
* designer) that this is bad.
*/