Skip to content

Commit 8720ab7

Browse files
ludvigsjkartben
authored andcommitted
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]>
1 parent db207b0 commit 8720ab7

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
@@ -1038,43 +1038,36 @@ config BT_MESH_BLOB_IO_FLASH
10381038
default y
10391039
depends on BT_MESH_BLOB_SRV || BT_MESH_BLOB_CLI
10401040
depends on FLASH_MAP
1041+
depends on FLASH_PAGE_LAYOUT
10411042
help
10421043
Enable the BLOB flash stream for reading and writing BLOBs directly to
10431044
and from flash.
10441045

10451046
if BT_MESH_BLOB_IO_FLASH
10461047

10471048
config BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
1048-
bool "BLOB flash support for devices without erase"
1049-
default y if FLASH_HAS_NO_EXPLICIT_ERASE
1049+
bool "BLOB flash support for devices without erase [DEPRECATED]"
1050+
default n
10501051
depends on FLASH_HAS_NO_EXPLICIT_ERASE
1052+
select DEPRECATED
10511053
help
1052-
Enable path supporting devices without erase. This option appears only
1053-
if there are devices without explicit erase requirements in the system
1054-
and may be disabled to reduce code size in case when no operations
1055-
are intended on such type of devices.
1054+
This option is deprecated and is no longer used by the BLOB IO Flash module.
10561055

10571056
config BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1058-
bool "BLOB flash support for devices with erase"
1059-
default y if FLASH_HAS_EXPLICIT_ERASE
1057+
bool "BLOB flash support for devices with erase [DEPRECATED]"
1058+
default n
10601059
depends on FLASH_HAS_EXPLICIT_ERASE
10611060
depends on FLASH_PAGE_LAYOUT
1061+
select DEPRECATED
10621062
help
1063-
Enable path supporting devices with erase. This option appears only
1064-
if there are devices requiring erase, before write, in the system
1065-
and may be disabled to reduce code size in case when no operations
1066-
are intended on such type of devices.
1067-
1068-
if BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1063+
This option is deprecated and is no longer used by the BLOB IO Flash module.
10691064

10701065
config BT_MESH_BLOB_IO_FLASH_WRITE_BLOCK_SIZE_MAX
10711066
int "Maximum supported write block size"
10721067
default 4
10731068
help
10741069
The BLOB IO Flash module will support flash devices with explicit erase
1075-
using a write block size of at most this value.
1076-
1077-
endif # BT_MESH_BLOB_IO_FLASH_WITH_ERASE
1070+
when this value is set to a multiple of the device write block size.
10781071

10791072
endif # BT_MESH_BLOB_IO_FLASH
10801073

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)