Skip to content

Commit f785989

Browse files
ludvigsjrlubos
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: Deprecate blob_io_flash erase cap options
The only reason to keep these would be to enable conditional compilation of some parts of the code. However, we can't see enough benefit in doing this, particularly since the flash driver itself will conditionally handle certain paths depending on erase caps, so the options are deprecated to reduce complexity. Signed-off-by: Ludvig Jordet <[email protected]> (cherry picked from commit 8720ab7)
1 parent ee186d9 commit f785989

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

subsys/bluetooth/mesh/Kconfig

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,43 +1053,36 @@ config BT_MESH_BLOB_IO_FLASH
10531053
default y
10541054
depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI
10551055
depends on FLASH_MAP
1056+
depends on FLASH_PAGE_LAYOUT
10561057
help
10571058
Enable the BLOB flash stream for reading and writing BLOBs directly to
10581059
and from flash.
10591060

10601061
if BT_MESH_BLOB_IO_FLASH
10611062

10621063
config BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
1063-
bool "BLOB flash support for devices without erase"
1064-
default y if FLASH_HAS_NO_EXPLICIT_ERASE
1064+
bool "BLOB flash support for devices without erase [DEPRECATED]"
1065+
default n
10651066
depends on FLASH_HAS_NO_EXPLICIT_ERASE
1067+
select DEPRECATED
10661068
help
1067-
Enable path supporting devices without erase. This option appears only
1068-
if there are devices without explicit erase requirements in the system
1069-
and may be disabled to reduce code size in case when no operations
1070-
are intended on such type of devices.
1069+
This option is deprecated and is no longer used by the BLOB IO Flash module.
10711070

10721071
config BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1073-
bool "BLOB flash support for devices with erase"
1074-
default y if FLASH_HAS_EXPLICIT_ERASE
1072+
bool "BLOB flash support for devices with erase [DEPRECATED]"
1073+
default n
10751074
depends on FLASH_HAS_EXPLICIT_ERASE
10761075
depends on FLASH_PAGE_LAYOUT
1076+
select DEPRECATED
10771077
help
1078-
Enable path supporting devices with erase. This option appears only
1079-
if there are devices requiring erase, before write, in the system
1080-
and may be disabled to reduce code size in case when no operations
1081-
are intended on such type of devices.
1082-
1083-
if BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1078+
This option is deprecated and is no longer used by the BLOB IO Flash module.
10841079

10851080
config BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX
10861081
int "Maximum supported write block size"
10871082
default 4
10881083
help
10891084
The BLOB IO Flash module will support flash devices with explicit erase
1090-
using a write block size of at most this value.
1091-
1092-
endif # BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1085+
when this value is set to a multiple of the device write block size.
10931086

10941087
endif # BT_MESH_BLOB_IO_FLASH
10951088

subsys/bluetooth/mesh/blob_io_flash.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ static void io_close(const struct bt_mesh_blob_io *io,
7070
flash_area_close(flash->area);
7171
}
7272

73-
/* Erasure code not needed if no flash in the system requires explicit erase */
74-
#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
7573
static inline int erase_device_block(const struct flash_area *fa, off_t start, size_t size)
7674
{
7775
const struct device *fdev = flash_area_get_device(fa);
@@ -82,15 +80,12 @@ static inline int erase_device_block(const struct flash_area *fa, off_t start, s
8280
return -ENODEV;
8381
}
8482

85-
#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
86-
/* We have a mix of devices in system */
8783
const struct flash_parameters *fparam = flash_get_parameters(fdev);
8884

8985
/* If device has no erase requirement then do nothing */
9086
if (!(flash_params_get_erase_cap(fparam) & FLASH_ERASE_C_EXPLICIT)) {
9187
return 0;
9288
}
93-
#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE */
9489

9590
err = flash_get_page_info_by_offs(fdev, start, &page);
9691
if (err) {
@@ -120,7 +115,6 @@ static int block_start(const struct bt_mesh_blob_io *io,
120115

121116
return erase_device_block(flash->area, flash->offset + block->offset, block->size);
122117
}
123-
#endif /* CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE */
124118

125119
static int rd_chunk(const struct bt_mesh_blob_io *io,
126120
const struct bt_mesh_blob_xfer *xfer,
@@ -199,11 +193,7 @@ int bt_mesh_blob_io_flash_init(struct bt_mesh_blob_io_flash *flash,
199193
flash->offset = offset;
200194
flash->io.open = io_open;
201195
flash->io.close = io_close;
202-
#ifdef CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
203196
flash->io.block_start = block_start;
204-
#else
205-
flash->io.block_start = NULL;
206-
#endif
207197
flash->io.block_end = NULL;
208198
flash->io.rd = rd_chunk;
209199
flash->io.wr = wr_chunk;

0 commit comments

Comments
 (0)