aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-5.4/450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch
blob: fe2d7a6b230878de66a0282bba280f4a2355f1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 22 Feb 2018 11:11:57 +0100
Subject: [PATCH] mtd: spi-nor: allow NOR driver to write fewer bytes than
 requested

The write size can be constrained by the maximum message/transfer size
of the SPI controller. Only check for ret = 0 to avoid an infinite loop.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -2706,7 +2706,7 @@ static int spi_nor_write(struct mtd_info
 
 		write_enable(nor);
 		ret = spi_nor_write_data(nor, addr, page_remain, buf + i);
-		if (ret < 0)
+		if (ret <= 0)
 			goto write_err;
 		written = ret;
 
g ATH79_DEV_DSA + def_bool n + +config ATH79_DEV_ETH + def_bool n + config PCI_AR724X def_bool n @@ -119,6 +133,10 @@ config ATH79_DEV_GPIO_BUTTONS config ATH79_DEV_LEDS_GPIO def_bool n +config ATH79_DEV_NFC + depends on (SOC_AR934X || SOC_QCA955X) + def_bool n + config ATH79_DEV_SPI def_bool n @@ -129,4 +147,14 @@ config ATH79_DEV_WMAC depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) def_bool n +config ATH79_NVRAM + def_bool n + +config ATH79_PCI_ATH9K_FIXUP + def_bool n + +config ATH79_ROUTERBOOT + select LZO_DECOMPRESS + def_bool n + endif