From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g3JSS-0004tD-LL for barebox@lists.infradead.org; Fri, 21 Sep 2018 11:18:50 +0000 From: Sascha Hauer Date: Fri, 21 Sep 2018 13:18:15 +0200 Message-Id: <20180921111820.29742-4-s.hauer@pengutronix.de> In-Reply-To: <20180921111820.29742-1-s.hauer@pengutronix.de> References: <20180921111820.29742-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 3/8] mtd: mtdraw: do not write empty buffers To: Barebox List When a page is completely 0xff then do not write it since users expect pages to be writable when they are empty. Signed-off-by: Sascha Hauer --- drivers/mtd/mtdraw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c index 3ad9de80a2..bfae795bd7 100644 --- a/drivers/mtd/mtdraw.c +++ b/drivers/mtd/mtdraw.c @@ -165,6 +165,9 @@ static ssize_t mtdraw_blkwrite(struct mtd_info *mtd, const void *buf, struct mtd_oob_ops ops; int ret; + if (mtd_buf_all_ff(buf, mtd->writesize + mtd->oobsize)) + return 0; + ops.mode = MTD_OPS_RAW; ops.ooboffs = 0; ops.datbuf = (void *)buf; -- 2.19.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox