From 45449c7b844dbb54d056c9ba7313f9a372752c51 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 17 Mar 2021 10:14:46 +0100 Subject: [PATCH] storage: remove flash_write_protection_set() usage This patch removes scenario which was testing deprecated API behaviors. Needed as As flash_write_protection_set() was deprecated and became no-operation. Signed-off-by: Andrzej Puzdrowski --- subsys/storage/flash_map/flash_map.c | 16 ---------------- subsys/storage/stream/stream_flash.c | 4 ---- 2 files changed, 20 deletions(-) diff --git a/subsys/storage/flash_map/flash_map.c b/subsys/storage/flash_map/flash_map.c index 926592595cb..313877f7ed5 100644 --- a/subsys/storage/flash_map/flash_map.c +++ b/subsys/storage/flash_map/flash_map.c @@ -210,16 +210,8 @@ int flash_area_write(const struct flash_area *fa, off_t off, const void *src, flash_dev = device_get_binding(fa->fa_dev_name); - rc = flash_write_protection_set(flash_dev, false); - if (rc) { - return rc; - } - rc = flash_write(flash_dev, fa->fa_off + off, (void *)src, len); - /* Ignore errors here - this does not affect write operation */ - (void) flash_write_protection_set(flash_dev, true); - return rc; } @@ -234,16 +226,8 @@ int flash_area_erase(const struct flash_area *fa, off_t off, size_t len) flash_dev = device_get_binding(fa->fa_dev_name); - rc = flash_write_protection_set(flash_dev, false); - if (rc) { - return rc; - } - rc = flash_erase(flash_dev, fa->fa_off + off, len); - /* Ignore errors here - this does not affect write operation */ - (void) flash_write_protection_set(flash_dev, true); - return rc; } diff --git a/subsys/storage/stream/stream_flash.c b/subsys/storage/stream/stream_flash.c index 1095660def4..5c5a99d080e 100644 --- a/subsys/storage/stream/stream_flash.c +++ b/subsys/storage/stream/stream_flash.c @@ -35,9 +35,7 @@ int stream_flash_erase_page(struct stream_flash_ctx *ctx, off_t off) LOG_DBG("Erasing page at offset 0x%08lx", (long)page.start_offset); - flash_write_protection_set(ctx->fdev, false); rc = flash_erase(ctx->fdev, page.start_offset, page.size); - flash_write_protection_set(ctx->fdev, true); if (rc != 0) { LOG_ERR("Error %d while erasing page", rc); @@ -71,9 +69,7 @@ static int flash_sync(struct stream_flash_ctx *ctx) } } - flash_write_protection_set(ctx->fdev, false); rc = flash_write(ctx->fdev, write_addr, ctx->buf, ctx->buf_bytes); - flash_write_protection_set(ctx->fdev, true); if (rc != 0) { LOG_ERR("flash_write error %d offset=0x%08zx", rc,